Skip to content

quantpylib.wrappers.oanda

Oanda

A class for interacting with Oanda API for CFD data.

Read

https://developer.oanda.com/rest-live-v20/introduction/

__init__(account_id, secret, env='practice')

Initialize the Oanda instance with the account ID, API token secret, and environment.

Parameters:

Name Type Description Default
account_id str

Oanda account ID.

required
secret str

Oanda API token secret.

required
env str

Environment type, either "practice" or "live".

'practice'

close_market_data_stream(ticker, **kwargs) async

Close the streaming for market data of the specified ticker.

Parameters:

Name Type Description Default
ticker str

The trading instrument ticker.

required

Returns:

Type Description

None

get_ticker_metadata(ticker, **kwargs)

Retrieve metadata for the specified ticker.

Parameters:

Name Type Description Default
ticker str

The trading instrument ticker.

required

Returns:

Name Type Description
dict

Metadata for the specified ticker.

get_tickers_in_exchange(**kwargs)

Retrieve the list of tickers available in the Oanda account.

Returns:

Name Type Description
dict

A dictionary of tickers available in the Oanda account.

get_trade_bars(ticker, start, end, granularity, granularity_multiplier, **kwargs)

Retrieve OHLCV trade bar data for the specified ticker and time range.

Parameters:

Name Type Description Default
ticker str

The trading instrument ticker.

required
start datetime

The start date and time for data retrieval.

required
end datetime

The end date and time for data retrieval.

required
granularity Period

The period type for the OHLCV bars.

required
granularity_multiplier int

The granularity multiplier.

required

Returns:

Type Description

pd.DataFrame: The OHLCV trade bar data for the specified ticker and time range.

stream_market_data(ticker, stream_buffer, **kwargs) async

Start streaming market data for the specified ticker.

Parameters:

Name Type Description Default
ticker str

The trading instrument ticker.

required
stream_buffer defaultdict

A dictionary that stores deque instances for streaming data.

required

Returns:

Type Description

None