TradingStrategyDataSource#

tradingstrategy.frameworks.qstrader.TradingStrategyDataSource class.

class TradingStrategyDataSource[source]#

Bases: object

QSTrader daily price integration for Capitalgram dataframe object.

__init__(exchange_universe, pair_universe, candle_universe, price_look_back_candles=5)[source]#
Parameters

Methods

__init__(exchange_universe, pair_universe, ...)

param exchange_universe

get_ask(dt, pair_id[, complain])

get_assets_historical_closes(start_dt, ...)

Obtain a multi-asset historical range of closing prices as a DataFrame, indexed by timestamp with asset symbols as columns.

get_bid(dt, pair_id[, complain])

Get a bid price for an asset at a certain timestamp.

get_price(dt, pair_id[, ohlc, complain])

Get a price for a trading pair base pair from candle data.

__init__(exchange_universe, pair_universe, candle_universe, price_look_back_candles=5)[source]#
Parameters
get_price(dt, pair_id, ohlc='Open', complain=False)[source]#

Get a price for a trading pair base pair from candle data.

If there is no candle (no trades at the day), look for a previous day.

Parameters
Return type

float

get_bid(dt, pair_id, complain=False)[source]#

Get a bid price for an asset at a certain timestamp.

LIMITATIONS: - Assume using daily bars - Use opening price of each candle

Parameters
Return type

float

get_assets_historical_closes(start_dt, end_dt, assets)[source]#

Obtain a multi-asset historical range of closing prices as a DataFrame, indexed by timestamp with asset symbols as columns.

start_dtpd.Timestamp

The starting datetime of the range to obtain.

end_dtpd.Timestamp

The ending datetime of the range to obtain.

assetslist[str]

The list of asset symbols to obtain closing prices for.

pd.DataFrame

The multi-asset closing prices DataFrame.