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', **kwargs)

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'

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) async

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.

l1_book_subscribe(ticker, handler, **kwargs) async

Start streaming market data for the specified ticker.

Parameters:

Name Type Description Default
ticker str

Trading instrument ticker.

required
handler coroutine

A coroutine handler for the message received.

required

Returns: None

l1_book_unsubscribe(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