Market#
- class pams.Market(market_id, prng, simulator, name, logger=None)[source]#
Market class.
See also
pams.index_market.IndexMarket
: IndexMarket
- change_fundamental_price(scale)[source]#
change fundamental price.
- Parameters:
scale (float) – scale.
- Return type:
None
- Returns:
None
- convert_to_price(tick_level)[source]#
convert tick to price.
- Parameters:
tick_level (int) – tick level.
- Returns:
price.
- Return type:
float
- convert_to_tick_level(price, is_buy)[source]#
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.
- Parameters:
price (float) – price.
is_buy (bool) – buy order or not.
- Returns:
price for tick level.
- Return type:
int
- convert_to_tick_level_rounded_lower(price)[source]#
convert price to tick level rounded lower.
- Parameters:
price (float) – price.
- Returns:
price for tick level rounded lower.
- Return type:
int
- convert_to_tick_level_rounded_upper(price)[source]#
convert price to tick level rounded upper.
- Parameters:
price (float) – price.
- Returns:
price for tick level rounded upper.
- Return type:
int
- get_best_buy_price()[source]#
get the best buy price.
- Returns:
the best buy price.
- Return type:
float, Optional
- get_best_sell_price()[source]#
get the best sell price.
- Returns:
the best sell price.
- Return type:
float, Optional
- get_buy_order_book()[source]#
get buy order book.
- Returns:
buy order book.
- Return type:
Dict[Optional[float], int]
- get_executed_total_price(time=None)[source]#
get executed total price.
- Parameters:
time (Union[int, None]) – time step.
- Returns:
total price.
- Return type:
float
- get_executed_total_prices(times=None)[source]#
get executed total prices.
- Parameters:
times (Union[Iterable[int], None]) – time steps.
- Returns:
total prices.
- Return type:
List[float]
- get_executed_volume(time=None)[source]#
get executed volume.
- Parameters:
time (Union[int, None]) – time step.
- Returns:
volume.
- Return type:
int
- get_executed_volumes(times=None)[source]#
get executed volumes.
- Parameters:
times (Union[Iterable[int], None]) – time steps.
- Returns:
volumes.
- Return type:
List[int]
- get_fundamental_price(time=None)[source]#
get fundamental price.
- Parameters:
time (Union[int, None]) – time step.
- Returns:
fundamental price.
- Return type:
float
- get_fundamental_prices(times=None)[source]#
get fundamental prices.
- Parameters:
times (Union[Iterable[int], None]) – time steps.
- Returns:
fundamental prices.
- Return type:
List[float]
- get_last_executed_price(time=None)[source]#
get price executed last step.
- Parameters:
time (Union[int, None]) – time step.
- Returns:
price.
- Return type:
float, Optional
- get_last_executed_prices(times=None)[source]#
get prices executed last steps.
- Parameters:
times (Union[Iterable[int], None]) – time steps.
- Returns:
prices.
- Return type:
List[Optional[float]]
- get_market_price(time=None)[source]#
get market price.
- Parameters:
time (Union[int, None]) – time step.
- Returns:
extracted data.
- Return type:
float
- get_market_prices(times=None)[source]#
get market prices.
- Parameters:
times (Union[Iterable[int], None]) – range of time steps.
- Returns:
extracted sequential data.
- Return type:
List[float]
- get_mid_price(time=None)[source]#
get middle price.
- Parameters:
time (Union[int, None]) – time step.
- Returns:
middle price.
- Return type:
float, Optional
- get_mid_prices(times=None)[source]#
get middle prices.
- Parameters:
times (Union[Iterable[int], None]) – time steps.
- Returns:
middle prices.
- Return type:
List[Optional[float]]
- get_n_buy_order(time=None)[source]#
get the number of buy order.
- Parameters:
time (Union[int, None]) – time step.
- Returns:
number of buy order.
- Return type:
int
- get_n_buy_orders(times=None)[source]#
get the number of buy orders.
- Parameters:
times (Union[Iterable[int], None]) – time steps.
- Returns:
number of buy orders.
- Return type:
List[int]
- get_n_sell_order(time=None)[source]#
get the number of sell order.
- Parameters:
time (Union[int, None]) – time step.
- Returns:
number of sell order.
- Return type:
int
- get_n_sell_orders(times=None)[source]#
get the number of sell orders.
- Parameters:
times (Union[Iterable[int], None]) – time steps.
- Returns:
number of sell orders.
- Return type:
List[int]
- get_sell_order_book()[source]#
get sell order book.
- Returns:
sell order book.
- Return type:
Dict[Optional[float], int]
- get_vwap(time=None)[source]#
get VWAP.
- Parameters:
time (int, Optional) – time step.
- Returns:
VWAP.
- Return type:
float
- property is_running: bool#
get whether this market is running or not.
- Returns:
whether this market is running or not.
- Return type:
bool
- remain_executable_orders()[source]#
check if there are remain executable orders in this market.
- Returns:
whether some orders is executable or not.
- Return type:
bool
- setup(settings, *args, **kwargs)[source]#
setup market configuration from setting format.
- Parameters:
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”.
- Return type:
None
- Returns:
None