Market#

class pams.Market(market_id, prng, simulator, name, logger=None)[ソース]#

Market class.

参考

change_fundamental_price(scale)[ソース]#

change fundamental price.

パラメータ:

scale (float) -- scale.

戻り値の型:

None

戻り値:

None

convert_to_price(tick_level)[ソース]#

convert tick to price.

パラメータ:

tick_level (int) -- tick level.

戻り値:

price.

戻り値の型:

float

convert_to_tick_level(price, is_buy)[ソース]#

convert price to tick level. If it is buy order price, it is rounded lower. If it is sell order price, it is rounded upper.

パラメータ:
  • price (float) -- price.

  • is_buy (bool) -- buy order or not.

戻り値:

price for tick level.

戻り値の型:

int

convert_to_tick_level_rounded_lower(price)[ソース]#

convert price to tick level rounded lower.

パラメータ:

price (float) -- price.

戻り値:

price for tick level rounded lower.

戻り値の型:

int

convert_to_tick_level_rounded_upper(price)[ソース]#

convert price to tick level rounded upper.

パラメータ:

price (float) -- price.

戻り値:

price for tick level rounded upper.

戻り値の型:

int

get_best_buy_price()[ソース]#

get the best buy price.

戻り値:

the best buy price.

戻り値の型:

float, Optional

get_best_sell_price()[ソース]#

get the best sell price.

戻り値:

the best sell price.

戻り値の型:

float, Optional

get_buy_order_book()[ソース]#

get buy order book.

戻り値:

buy order book.

戻り値の型:

Dict[Optional[float], int]

get_executed_total_price(time=None)[ソース]#

get executed total price.

パラメータ:

time (Union[int, None]) -- time step.

戻り値:

total price.

戻り値の型:

float

get_executed_total_prices(times=None)[ソース]#

get executed total prices.

パラメータ:

times (Union[Iterable[int], None]) -- time steps.

戻り値:

total prices.

戻り値の型:

List[float]

get_executed_volume(time=None)[ソース]#

get executed volume.

パラメータ:

time (Union[int, None]) -- time step.

戻り値:

volume.

戻り値の型:

int

get_executed_volumes(times=None)[ソース]#

get executed volumes.

パラメータ:

times (Union[Iterable[int], None]) -- time steps.

戻り値:

volumes.

戻り値の型:

List[int]

get_fundamental_price(time=None)[ソース]#

get fundamental price.

パラメータ:

time (Union[int, None]) -- time step.

戻り値:

fundamental price.

戻り値の型:

float

get_fundamental_prices(times=None)[ソース]#

get fundamental prices.

パラメータ:

times (Union[Iterable[int], None]) -- time steps.

戻り値:

fundamental prices.

戻り値の型:

List[float]

get_last_executed_price(time=None)[ソース]#

get price executed last step.

パラメータ:

time (Union[int, None]) -- time step.

戻り値:

price.

戻り値の型:

float, Optional

get_last_executed_prices(times=None)[ソース]#

get prices executed last steps.

パラメータ:

times (Union[Iterable[int], None]) -- time steps.

戻り値:

prices.

戻り値の型:

List[Optional[float]]

get_market_price(time=None)[ソース]#

get market price.

パラメータ:

time (Union[int, None]) -- time step.

戻り値:

extracted data.

戻り値の型:

float

get_market_prices(times=None)[ソース]#

get market prices.

パラメータ:

times (Union[Iterable[int], None]) -- range of time steps.

戻り値:

extracted sequential data.

戻り値の型:

List[float]

get_mid_price(time=None)[ソース]#

get middle price.

パラメータ:

time (Union[int, None]) -- time step.

戻り値:

middle price.

戻り値の型:

float, Optional

get_mid_prices(times=None)[ソース]#

get middle prices.

パラメータ:

times (Union[Iterable[int], None]) -- time steps.

戻り値:

middle prices.

戻り値の型:

List[Optional[float]]

get_n_buy_order(time=None)[ソース]#

get the number of buy order.

パラメータ:

time (Union[int, None]) -- time step.

戻り値:

number of buy order.

戻り値の型:

int

get_n_buy_orders(times=None)[ソース]#

get the number of buy orders.

パラメータ:

times (Union[Iterable[int], None]) -- time steps.

戻り値:

number of buy orders.

戻り値の型:

List[int]

get_n_sell_order(time=None)[ソース]#

get the number of sell order.

パラメータ:

time (Union[int, None]) -- time step.

戻り値:

number of sell order.

戻り値の型:

int

get_n_sell_orders(times=None)[ソース]#

get the number of sell orders.

パラメータ:

times (Union[Iterable[int], None]) -- time steps.

戻り値:

number of sell orders.

戻り値の型:

List[int]

get_sell_order_book()[ソース]#

get sell order book.

戻り値:

sell order book.

戻り値の型:

Dict[Optional[float], int]

get_time()[ソース]#

get time step.

戻り値の型:

int

get_vwap(time=None)[ソース]#

get VWAP.

パラメータ:

time (int, Optional) -- time step.

戻り値:

VWAP.

戻り値の型:

float

property is_running: bool#

get whether this market is running or not.

戻り値:

whether this market is running or not.

戻り値の型:

bool

remain_executable_orders()[ソース]#

check if there are remain executable orders in this market.

戻り値:

whether some orders is executable or not.

戻り値の型:

bool

setup(settings, *args, **kwargs)[ソース]#

setup market configuration from setting format.

パラメータ:

settings (Dict[str, Any]) -- market configuration. Usually, automatically set from json config of simulator. This must include the parameters "tickSize" and either "marketPrice" or "fundamentalPrice". This can include the parameter "outstandingShares" and "tradeVolume".

戻り値の型:

None

戻り値:

None