Fundamentals#

class pams.Fundamentals(prng)[source]#

Fundamental generator for simulator.

add_market(market_id, initial, drift, volatility, start_at=0)[source]#

add a market whose fundamental prices are generated in this class.

Parameters:
  • market_id (int) – market ID to add.

  • initial (float) – initial value.

  • drift (float) – drifts.

  • volatility (float) – volatility.

  • start_at (int) – time step to start simulation (default 0).

Return type:

None

Returns:

None

change_drift(market_id, drift, time=0)[source]#

change drift.

Parameters:
  • market_id (int) – market ID.

  • drift (float) – drift.

  • time (int) – time step to apply the change (default 0).

Return type:

None

Returns:

None

change_volatility(market_id, volatility, time=0)[source]#

change volatility.

Parameters:
  • market_id (int) – market ID.

  • volatility (float) – volatility.

  • time (int) – time step to apply the change(default 0).

Return type:

None

Returns:

None

get_fundamental_price(market_id, time)[source]#

get a fundamental price.

Parameters:
  • market_id (int) – market ID.

  • time (int) – time step to get the price.

Returns:

fundamental price at the specified time step.

Return type:

float

get_fundamental_prices(market_id, times)[source]#

get some fundamental prices.

Parameters:
  • market_id (int) – market ID.

  • times (Iterable[int]) – time steps to get the price.

Returns:

fundamental prices in specified range of time steps.

Return type:

List[float]

remove_correlation(market_id1, market_id2, time=0)[source]#

remove correlation.

Parameters:
  • market_id1 (int) – one of the market IDs to remove correlation.

  • market_id2 (int) – the other of the market IDs to remove correlation.

  • time (int) – time step to apply the correlation (default 0).

Return type:

None

Returns:

None

remove_market(market_id)[source]#

remove a market from the list of markets whose fundamental prices are generated in this class.

Parameters:

market_id (int) – market ID to remove.

Return type:

None

Returns:

None

set_correlation(market_id1, market_id2, corr, time=0)[source]#

set correlation between fundamental prices of markets.

Parameters:
  • market_id1 (int) – one of the market IDs to set correlation.

  • market_id2 (int) – the other of the market IDs to set correlation.

  • corr (float) – correlation.

  • time (int) – time step to apply the correlation (default 0).

Return type:

None

Returns:

None