| Top | Historical Data | Intraday Frequency | Defining Time Period | Stock Indexes | Commodities Cryptocurrencies Real-Time Data

Finance APIs: FXCM
| FXCM Online | Account Login |
Evan Marie online: | EvanMarie.com| EvanMarie@Proton.me | Linked In | GitHub | Hugging Face | Mastadon | Jovian.ai | TikTok | CodeWars | Discord ⇨ ✨ EvanMarie ✨#6114 |

Pros and Cons of FXCM
Pros:


Cons:

FXCM: First Steps
# api is an fxcmpy object
# api.get_instruments() - trading instruments
api.close()- disconnect from the server


| Top | Historical Data | Intraday Frequency | Defining Time Period | Stock Indexes | Commodities Cryptocurrencies Real-Time Data

Downloading Historical Data
- get_candles()
# hourly data by default


| Top | Historical Data | Intraday Frequency | Defining Time Period | Stock Indexes | Commodities Cryptocurrencies Real-Time Data

Intraday Frequency
- period: string, the granularity of the data
- Must be one of: 'm1', 'm5', 'm15', 'm30', 'H1', 'H2', 'H3', 'H4', 'H6', 'H8', 'D1', 'W1', or 'M1'
- number: integer (default 10), the number of candles to receive.


| Top | Historical Data | Intraday Frequency | Defining Time Period | Stock Indexes | Commodities Cryptocurrencies Real-Time Data

Defining a Time Period
- by default, FXCM returns the 10 most recent time stamps
- this section will cover the ways to specify other parameters
Defining time with number
# daily data, number = 10000 (maxiumum number possible)
^ passed 10,000, but received 6,213, because that is the most available
Defining time with start & end (daily data)
Getting hourly data
Getting hourly data with start and end
- was able to get more than 10,000
- this is the exact date range it would allow, no more
- this is a trial and error process, how to maximize the time period
Getting data by the minute
Getting data by the minute with start and end
- was able to get close to 16,000 records
- this is again the exact date range it would allow, no more
- this is more data than yfinance or Alpha Vantage allowed
Selecting specific columns to import


| Top | Historical Data | Intraday Frequency | Defining Time Period | Stock Indexes | Commodities Cryptocurrencies Real-Time Data

Historical Prices for Stock Indexes

SPX500: daily data, last 10,000 days
- returns price index and not total return index
- this is the more commonly used index
- price return - just the change in price
- total return accounts for dividends and the reinvestment thereof
Dow Jones Industrial Average: daily data, last 10,000 days
GER30: hourly data, May 28, 2021 to current
- this is a total return index, not price return


| Top | Historical Data | Intraday Frequency | Defining Time Period | Stock Indexes | Commodities Cryptocurrencies Real-Time Data

Historical Prices for Commodities
- Oil, Gold, Silver, Copper, Wheat, Corn
- FXCM is the best place for commodities information
US Oil: daily, max results
Gold in USD: daily data, max results
Siver in USD: daily data, max results
Natural Gas: hourly data, max results
Soy Futures: hourly data, max results


| Top | Historical Data | Intraday Frequency | Defining Time Period | Stock Indexes | Commodities Cryptocurrencies Real-Time Data

Historical Prices for Cryptocurrencies
- they used to have Ethereum and a few others, but those no longer work
Bitcoin: daily data, start and end dates


| Top | Historical Data | Intraday Frequency | Defining Time Period | Stock Indexes | Commodities Cryptocurrencies Real-Time Data

High Frequency Real-Time Data
- FXCM supports high frequency real-time data for some instruments
- this is something that usually costs a great deal for a subscription to access
api.subscribe_market_data()
Subscribe to EUR/USD exchange data
api.get_subscribed_symbols() - get the current open subscriptions
api.get_last_price() - get the last reported price for a symbol
api.get_prices() - get all available data for a subscription since the subscription was started
Subscribing to Bitcoin also, because Euro is not updating
Stream live data:
Function to stream the current ask price
Unsubscribe from market data

| Top | Historical Data | Intraday Frequency | Defining Time Period | Stock Indexes | Commodities Cryptocurrencies Real-Time Data