Skip to main content

Price Simulator

This package generates price trajectories of asset-pairs using a geometric Brownian motion (GBM) model as the base functionality. In the context of generating price series data for applications in blockchain, the resulting price trajectories can be thought of as an off-chain price feed not linked to any on-chain state.

Different functionality can modify the GBM if needed, and will be discussed in the following sections. In order to generate a price at each time step, the GBM model requires both a mean and a variance as an input parameter. The mean input parameter is calculated as the mean of the inputted price series (acquired from using a DAAS if specified), but can be modified by the market_drift functionality.

There are various mode options to calculate the value of the volatility parameter to be used in the GBM model:

  • mode = 'constant'. The volatility parameter is calculated from the inputted price data, and the volatility input parameter is kept fixed as a function of time. I.e., the same numerical value of the volatility will be used as an input to the GBM model at every time step.
  • mode = 'cccgarch'. A GARCH model is used to calculate a different volatility input parameter for each time step. The exact GARCH model is a $p=q=1$, $o=0$ model, and with a constant mean.
  • mode = 'cccgarch-gridsearch'. CCC-GARCH model where the p and q values are optimized over [1, 3] each and the fit with the minimal Akaike information criterion (AIC) is selected. This mode is more accurate than cccgarch because the optimal p and q values for each price series is identified, but this approach is much slower (by ~10x) due to the need to perform this optimization.
  • mode = 'ewma'. An exponentially weighted moving average model is used to calculate a different volatility for each time step using the previous volatilities.

Note, there is a large conceptual difference between the volatilities calculated as input parameters as described above and the volatility of the overall price trajectory.

All relevant background information for the price simulator will be maintained on the Confluence page:

https://almanak.atlassian.net/wiki/spaces/PS/pages/36470785/Price+Simulation

At each time step, the values of final_paths/paths and floating are the most important. final_paths/paths represents the final price for the block at step t and floating represents the floating price of the current block before the block is committed to the blockchain. This floating price is necessary so that downward price pressure can be exerted from liquidations while still ensuring that we have a simulated element to the price simulator, preventing liquidations alone from having sole influence on the next price.

Multiple Trajectories

It is possible to generate multiple price trajectories in a single request. This can be done by specifying the trajectories value in the request payload.

If undefined, the default value is 1. If one price trajectory is returned, then the response type will be a JSON object. If more than one price trajectory is returned, then they will be returned as a list of JSON objects. The format of the JSON payload will remain the same.

Market Drift

The distribution of price trajectories from a GBM model will not enforce specific market conditions over many trajectories. A particular functionality of this package is to allow the distribution of generated price trajectories to move up (simulating a bull market), or move down (simulating a bear market), over the duration of the price trajectory. The market_drift_mode keyword determines the shape that should be taken for the market drift, while the market_drift keyword specifies the strength of this general trending functionality. See Price Modeling for more details on current supported market drift modes.

To enforce market conditions for particular assets, the market_drift parameter in the price simulator configuration payload can be used. This is formatted as a float, where more negative values represent a stronger bear market, more positive values represent a stronger bull market, and values closer to 0.0 represent a stronger ranging market. No value specified indicates that the standard methodology of GBM should be used. This is useful when wanting to force a market condition but have stable coins ignored, as a strong bull run should not affect the price of USDC-USD, for example. Also note that specifying divergent price movements for assets will affect the price trajectory behavior but is not the only dimension that goes into the price simulation, as asset correlation is still enforced (i.e., if you want three assets to have a strong bull run and one asset to have a strong bear run, the prices will diverge somewhat, but they will still be regulated by their asset correlation as modeled by GARCH).

Black Swan Event

The distributions of price trajectories from a GBM model will not enforce black swan events. Instead, there is a enable_black_swan_event input parameter to the price simulator, which can enable this functionality. This is formatted as a True or False boolean.

The behavior of the black swan event can be configured according to the black swan settings in src/utils/settings.py. Note that the black swan functionality overrides all other market conditions, e.g., no matter what the market drift is, a black swan event will happen if set.

Correlation Between Assets Different from Historical Correlation (NOT CURRENTLY SUPPORTED)

Crypto assets are typically very correlated. Different assets can be correlated within this package via the custom_correlation_matrix keyword, used as an input parameter into the price simulator. By default, the correlation between assets determined from the historical data is used.

A unique value of the correlation matrix is possible. This is formatted as a matrix of values representing the correlation between assets. Diagonal elements should be set to 1.0, and off-diagonal elements should be set to a value between -1.0 and 1.0. The indices of the matrix correspond to the order of the price data inputted through the price series keyword.

Stable Coins

Stable coins require unique behavior which is distinct from non-stable crypto tokens. Specifically, unless a depeg-ing event happens, the stable coin price trajectory needs to not drift outside of a tight price range around 1.0. The exact range could be determined from the volatility calculated from the stable coins inputted price data, which would then be used to set one of the parameters below.

If one of the price feeds is a stable coin, turn off the market_drift keyword for this token by setting it to None (null in JSON). Moreover, ensure the enable_black_swan_event keyword is set to False for a stable coin.

A depegging event for the stable coin can be simulated by setting the enable_black_swan_event keyword to True, and specifying the black swam parameters as described above.

Most Typical Usage

In most typical cases, a user of this package will want to generate price trajectories for multiple crypto assets, some of which are a stable-coin. The non-stable coin assets will be correlated, and a user will want the prices to drift in a user controlled direction. In such a scenario, the global and asset level price simulator settings can be generated and used within the package locally as follows:

from src.utils.settings import PriceSimulatorSettings

market_drift = 1.5

custom_correlation_matrix = None
global_price_simulator_settings = PriceSimulatorSettings.create(
market_drift=market_drift,
enable_black_swan_event=False,
custom_correlation_matrix = custom_correlation_matrix,
)

# Initialise a stable coin price trajectory
asset_price_simulator_settings = dict()
asset_price_simulator_settings[("USDT", "DAI")] = PriceSimulatorSettings.create_with_undefined(
market_drift=None,
enable_black_swan_event=False,
max_percentage_change=0.001,
max_value_percentage =0.001,
min_value_percentage =0.001,
)

Here, max_value_percentage specifies how far a generated price can fluctuate upwards from its initial value. For a stable coin, this can be set to its previously observed maximum value, or fixed to a certain number, etc. Asset level settings use the PriceSimulatorSettings.create_with_undefined() function, while the global setting just use the create() function. Asset specific settings override the global level asset settings. Any setting not provided is set to its default value in the src/utils/settings.py file.

If a black swan event is desired, specify the settings as indicated in that section.

Quick Start

API

To run the price simulator API, the following command can be used:

uvicorn src.main:app --host 0.0.0.0 --port 8888

The simplest way to query the API is to use Postman. Send a POST request to http://localhost:8888/<uri> with the payload in the Body tab of type raw.

The following endpoints are currently supported.

/run

The run endpoint can have two functionalities. The first is to query a bigQuery database in order to obtain historical data to use when generating price series. The second is to provide the historical data in the request payload.

The price names need to be formatted as a list of length two, where the first element corresponds to the first asset, and the second element to the second asset. Note that the ordering of the assets is important and is determined by how the prices are included in the database.

All request data requires price names, asset-level configs or historical data, a start and end block, a level of granularity in seconds (0 to simulate time steps at the block level), a price simulator configuration, the number of steps to simulate, the volatility mode, the maturity factor, an optional random seed for price generation, an optional random seed for volatility modeling, and an optional random seed for black swan events.

Note that the random seeds may either be a numeric list or a scalar value. When requesting multiple trajectories, the list format allows the price simulator to cycle through the list for each trajectory rather than use the same value for each.

To use the run endpoint to query the database to obtain the historical data, the assets field should contain a config for each price. This specifies the asset level overrides if desired. A global level config is also passed and defines properties that should hold across all assets unless otherwise overwritten for a particular asset in an asset-level config.

A sample payload:

{
"assets": [
{
"symbol": ["ETH", "USDT"],
"config": {
}
"start_price": 3000 # if start price is required
},
{
"symbol": ["USDT", "DAI"],
"config": {
"market_drift": null,
"max_percentage_change": 0.001,
"min_value_percentage": 0.005,
"max_value_percentage": 0.005
}
}
],
"start_block": 16085600,
"end_block": 16090000,
"granularity": 1,
"config": {
"market_drift": 1.0
},
"steps": 10,
"volatility_mode": "ewma",
"trajectories": 1,
"maturity": 1.0,
"random_seed_price": 42,
"random_seed_sigma": 42,
"random_seed_black_swan": 42
}

To use the run endpoint by providing the historical data, the assets payload should contain a historical_data field. A sample payload, this time providing the historical data directly rather than the start and end block numbers is:

{"assets": [ { "symbol" : ["BNT", "USDT"], "historical_data" : {"Date": {"0": 1669859999999, "1": 1669863599999, "2": 1669867199999, "3": 1669870799999, "4": 1669874399999, "5": 1669877999999, "6": 1669881599999, "7": 1669885199999, "8": 1669888799999, "9": 1669892399999, "10": 1669895999999, "11": 1669899599999, "12": 1669903199999, "13": 1669906799999, "14": 1669910399999, "15": 1669913999999, "16": 1669917599999, "17": 1669921199999, "18": 1669924799999, "19": 1669928399999, "20": 1669931999999, "21": 1669935599999, "22": 1669939199999, "23": 1669942799999, "24": 1669946399999, "25": 1669949999999, "26": 1669953599999, "27": 1669957199999, "28": 1669960799999, "29": 1669964399999, "30": 1669967999999, "31": 1669971599999, "32": 1669975199999, "33": 1669978799999, "34": 1669982399999, "35": 1669985999999, "36": 1669989599999, "37": 1669993199999, "38": 1669996799999, "39": 1670000399999, "40": 1670003999999, "41": 1670007599999, "42": 1670011199999, "43": 1670014799999, "44": 1670018399999, "45": 1670021999999, "46": 1670025599999, "47": 1670029199999, "48": 1670032799999, "49": 1670036399999, "50": 1670039999999, "51": 1670043599999, "52": 1670047199999, "53": 1670050799999, "54": 1670054399999, "55": 1670057999999, "56": 1670061599999, "57": 1670065199999, "58": 1670068799999, "59": 1670072399999, "60": 1670075999999, "61": 1670079599999, "62": 1670083199999, "63": 1670086799999, "64": 1670090399999, "65": 1670093999999, "66": 1670097599999, "67": 1670101199999, "68": 1670104799999, "69": 1670108399999, "70": 1670111999999, "71": 1670115599999, "72": 1670119199999, "73": 1670122799999, "74": 1670126399999, "75": 1670129999999, "76": 1670133599999, "77": 1670137199999, "78": 1670140799999, "79": 1670144399999, "80": 1670147999999, "81": 1670151599999, "82": 1670155199999, "83": 1670158799999, "84": 1670162399999, "85": 1670165999999, "86": 1670169599999, "87": 1670173199999, "88": 1670176799999, "89": 1670180399999, "90": 1670183999999, "91": 1670187599999, "92": 1670191199999, "93": 1670194799999, "94": 1670198399999, "95": 1670201999999, "96": 1670205599999, "97": 1670209199999, "98": 1670212799999, "99": 1670216399999}, "Close": {"0": 0.387, "1": 0.386, "2": 0.387, "3": 0.386, "4": 0.385, "5": 0.385, "6": 0.385, "7": 0.386, "8": 0.386, "9": 0.385, "10": 0.385, "11": 0.391, "12": 0.387, "13": 0.387, "14": 0.383, "15": 0.382, "16": 0.381, "17": 0.381, "18": 0.381, "19": 0.381, "20": 0.381, "21": 0.381, "22": 0.38, "23": 0.383, "24": 0.381, "25": 0.379, "26": 0.379, "27": 0.38, "28": 0.382, "29": 0.382, "30": 0.382, "31": 0.382, "32": 0.382, "33": 0.382, "34": 0.384, "35": 0.383, "36": 0.38, "37": 0.381, "38": 0.382, "39": 0.38, "40": 0.381, "41": 0.381, "42": 0.382, "43": 0.383, "44": 0.384, "45": 0.385, "46": 0.386, "47": 0.386, "48": 0.386, "49": 0.385, "50": 0.385, "51": 0.385, "52": 0.385, "53": 0.382, "54": 0.381, "55": 0.38, "56": 0.38, "57": 0.381, "58": 0.381, "59": 0.381, "60": 0.381, "61": 0.38, "62": 0.382, "63": 0.381, "64": 0.382, "65": 0.381, "66": 0.38, "67": 0.38, "68": 0.378, "69": 0.376, "70": 0.376, "71": 0.378, "72": 0.379, "73": 0.38, "74": 0.379, "75": 0.382, "76": 0.382, "77": 0.382, "78": 0.381, "79": 0.38, "80": 0.379, "81": 0.379, "82": 0.378, "83": 0.379, "84": 0.378, "85": 0.38, "86": 0.382, "87": 0.383, "88": 0.382, "89": 0.383, "90": 0.383, "91": 0.383, "92": 0.383, "93": 0.382, "94": 0.383, "95": 0.383, "96": 0.384, "97": 0.385, "98": 0.385, "99": 0.386}}}, { "symbol" : ["ETH", "USDT"], "historical_data" : {"Date": {"0": 1669427999999, "1": 1669431599999, "2": 1669435199999, "3": 1669438799999, "4": 1669442399999, "5": 1669445999999, "6": 1669449599999, "7": 1669453199999, "8": 1669456799999, "9": 1669460399999, "10": 1669463999999, "11": 1669467599999, "12": 1669471199999, "13": 1669474799999, "14": 1669478399999, "15": 1669481999999, "16": 1669485599999, "17": 1669489199999, "18": 1669492799999, "19": 1669496399999, "20": 1669499999999, "21": 1669503599999, "22": 1669507199999, "23": 1669510799999, "24": 1669514399999, "25": 1669517999999, "26": 1669521599999, "27": 1669525199999, "28": 1669528799999, "29": 1669532399999, "30": 1669535999999, "31": 1669539599999, "32": 1669543199999, "33": 1669546799999, "34": 1669550399999, "35": 1669553999999, "36": 1669557599999, "37": 1669561199999, "38": 1669564799999, "39": 1669568399999, "40": 1669571999999, "41": 1669575599999, "42": 1669579199999, "43": 1669582799999, "44": 1669586399999, "45": 1669589999999, "46": 1669593599999, "47": 1669597199999, "48": 1669600799999, "49": 1669604399999, "50": 1669607999999, "51": 1669611599999, "52": 1669615199999, "53": 1669618799999, "54": 1669622399999, "55": 1669625999999, "56": 1669629599999, "57": 1669633199999, "58": 1669636799999, "59": 1669640399999, "60": 1669643999999, "61": 1669647599999, "62": 1669651199999, "63": 1669654799999, "64": 1669658399999, "65": 1669661999999, "66": 1669665599999, "67": 1669669199999, "68": 1669672799999, "69": 1669676399999, "70": 1669679999999, "71": 1669683599999, "72": 1669687199999, "73": 1669690799999, "74": 1669694399999, "75": 1669697999999, "76": 1669701599999, "77": 1669705199999, "78": 1669708799999, "79": 1669712399999, "80": 1669715999999, "81": 1669719599999, "82": 1669723199999, "83": 1669726799999, "84": 1669730399999, "85": 1669733999999, "86": 1669737599999, "87": 1669741199999, "88": 1669744799999, "89": 1669748399999, "90": 1669751999999, "91": 1669755599999, "92": 1669759199999, "93": 1669762799999, "94": 1669766399999, "95": 1669769999999, "96": 1669773599999, "97": 1669777199999, "98": 1669780799999, "99": 1669784399999}, "Close": {"0": 1219.2, "1": 1218.22, "2": 1215.71, "3": 1222.97, "4": 1220.58, "5": 1216.9, "6": 1218.97, "7": 1216.27, "8": 1220.35, "9": 1220.07, "10": 1221.71, "11": 1219.26, "12": 1220.46, "13": 1214.27, "14": 1210.9, "15": 1209.76, "16": 1212.93, "17": 1208.29, "18": 1207.34, "19": 1208.12, "20": 1210.06, "21": 1201.32, "22": 1205.6, "23": 1206.19, "24": 1211.4, "25": 1215.35, "26": 1216.51, "27": 1218.99, "28": 1216.86, "29": 1216.54, "30": 1216.9, "31": 1211.73, "32": 1210.43, "33": 1212.68, "34": 1215.31, "35": 1214.4, "36": 1212.58, "37": 1212.86, "38": 1217.92, "39": 1213.82, "40": 1215.65, "41": 1217.59, "42": 1213.19, "43": 1213.55, "44": 1215.46, "45": 1216.25, "46": 1193.88, "47": 1194.79, "48": 1164.0, "49": 1163.81, "50": 1172.54, "51": 1174.29, "52": 1167.73, "53": 1175.09, "54": 1174.03, "55": 1174.84, "56": 1171.71, "57": 1167.86, "58": 1170.36, "59": 1170.43, "60": 1170.65, "61": 1166.85, "62": 1163.49, "63": 1177.02, "64": 1172.13, "65": 1168.21, "66": 1171.59, "67": 1174.68, "68": 1172.77, "69": 1170.81, "70": 1167.77, "71": 1167.11, "72": 1177.19, "73": 1182.57, "74": 1184.67, "75": 1197.87, "76": 1208.15, "77": 1204.44, "78": 1207.08, "79": 1215.06, "80": 1217.53, "81": 1214.49, "82": 1217.32, "83": 1216.25, "84": 1209.71, "85": 1205.4, "86": 1208.72, "87": 1209.24, "88": 1209.05, "89": 1215.37, "90": 1215.75, "91": 1222.5, "92": 1219.46, "93": 1223.17, "94": 1216.49, "95": 1274.77, "96": 1272.91, "97": 1271.02, "98": 1265.09, "99": 1270.09}} }, { "symbol" : ["LINK", "USDT"], "historical_data" : {"Date": {"0": 1669859999999, "1": 1669863599999, "2": 1669867199999, "3": 1669870799999, "4": 1669874399999, "5": 1669877999999, "6": 1669881599999, "7": 1669885199999, "8": 1669888799999, "9": 1669892399999, "10": 1669895999999, "11": 1669899599999, "12": 1669903199999, "13": 1669906799999, "14": 1669910399999, "15": 1669913999999, "16": 1669917599999, "17": 1669921199999, "18": 1669924799999, "19": 1669928399999, "20": 1669931999999, "21": 1669935599999, "22": 1669939199999, "23": 1669942799999, "24": 1669946399999, "25": 1669949999999, "26": 1669953599999, "27": 1669957199999, "28": 1669960799999, "29": 1669964399999, "30": 1669967999999, "31": 1669971599999, "32": 1669975199999, "33": 1669978799999, "34": 1669982399999, "35": 1669985999999, "36": 1669989599999, "37": 1669993199999, "38": 1669996799999, "39": 1670000399999, "40": 1670003999999, "41": 1670007599999, "42": 1670011199999, "43": 1670014799999, "44": 1670018399999, "45": 1670021999999, "46": 1670025599999, "47": 1670029199999, "48": 1670032799999, "49": 1670036399999, "50": 1670039999999, "51": 1670043599999, "52": 1670047199999, "53": 1670050799999, "54": 1670054399999, "55": 1670057999999, "56": 1670061599999, "57": 1670065199999, "58": 1670068799999, "59": 1670072399999, "60": 1670075999999, "61": 1670079599999, "62": 1670083199999, "63": 1670086799999, "64": 1670090399999, "65": 1670093999999, "66": 1670097599999, "67": 1670101199999, "68": 1670104799999, "69": 1670108399999, "70": 1670111999999, "71": 1670115599999, "72": 1670119199999, "73": 1670122799999, "74": 1670126399999, "75": 1670129999999, "76": 1670133599999, "77": 1670137199999, "78": 1670140799999, "79": 1670144399999, "80": 1670147999999, "81": 1670151599999, "82": 1670155199999, "83": 1670158799999, "84": 1670162399999, "85": 1670165999999, "86": 1670169599999, "87": 1670173199999, "88": 1670176799999, "89": 1670180399999, "90": 1670183999999, "91": 1670187599999, "92": 1670191199999, "93": 1670194799999, "94": 1670198399999, "95": 1670201999999, "96": 1670205599999, "97": 1670209199999, "98": 1670212799999, "99": 1670216399999}, "Close": {"0": 7.565, "1": 7.58, "2": 7.58, "3": 7.547, "4": 7.535, "5": 7.556, "6": 7.514, "7": 7.548, "8": 7.539, "9": 7.539, "10": 7.549, "11": 7.592, "12": 7.56, "13": 7.696, "14": 7.7, "15": 7.645, "16": 7.616, "17": 7.573, "18": 7.634, "19": 7.61, "20": 7.699, "21": 7.746, "22": 7.681, "23": 7.689, "24": 7.67, "25": 7.643, "26": 7.596, "27": 7.6, "28": 7.609, "29": 7.569, "30": 7.581, "31": 7.591, "32": 7.597, "33": 7.605, "34": 7.627, "35": 7.643, "36": 7.579, "37": 7.588, "38": 7.565, "39": 7.561, "40": 7.573, "41": 7.537, "42": 7.593, "43": 7.619, "44": 7.611, "45": 7.584, "46": 7.61, "47": 7.526, "48": 7.49, "49": 7.458, "50": 7.492, "51": 7.484, "52": 7.452, "53": 7.425, "54": 7.451, "55": 7.405, "56": 7.428, "57": 7.415, "58": 7.428, "59": 7.452, "60": 7.441, "61": 7.409, "62": 7.415, "63": 7.373, "64": 7.395, "65": 7.378, "66": 7.321, "67": 7.328, "68": 7.341, "69": 7.255, "70": 7.235, "71": 7.291, "72": 7.241, "73": 7.307, "74": 7.309, "75": 7.364, "76": 7.368, "77": 7.356, "78": 7.347, "79": 7.338, "80": 7.378, "81": 7.33, "82": 7.292, "83": 7.354, "84": 7.306, "85": 7.341, "86": 7.351, "87": 7.317, "88": 7.343, "89": 7.382, "90": 7.372, "91": 7.376, "92": 7.393, "93": 7.407, "94": 7.444, "95": 7.492, "96": 7.522, "97": 7.516, "98": 7.521, "99": 7.552}}}, {"symbol" : ["USDT", "DAI"], "historical_data" :{"Date": {"0": 1669859999999, "1": 1669863599999, "2": 1669867199999, "3": 1669870799999, "4": 1669874399999, "5": 1669877999999, "6": 1669881599999, "7": 1669885199999, "8": 1669888799999, "9": 1669892399999, "10": 1669895999999, "11": 1669899599999, "12": 1669903199999, "13": 1669906799999, "14": 1669910399999, "15": 1669913999999, "16": 1669917599999, "17": 1669921199999, "18": 1669924799999, "19": 1669928399999, "20": 1669931999999, "21": 1669935599999, "22": 1669939199999, "23": 1669942799999, "24": 1669946399999, "25": 1669949999999, "26": 1669953599999, "27": 1669957199999, "28": 1669960799999, "29": 1669964399999, "30": 1669967999999, "31": 1669971599999, "32": 1669975199999, "33": 1669978799999, "34": 1669982399999, "35": 1669985999999, "36": 1669989599999, "37": 1669993199999, "38": 1669996799999, "39": 1670000399999, "40": 1670003999999, "41": 1670007599999, "42": 1670011199999, "43": 1670014799999, "44": 1670018399999, "45": 1670021999999, "46": 1670025599999, "47": 1670029199999, "48": 1670032799999, "49": 1670036399999, "50": 1670039999999, "51": 1670043599999, "52": 1670047199999, "53": 1670050799999, "54": 1670054399999, "55": 1670057999999, "56": 1670061599999, "57": 1670065199999, "58": 1670068799999, "59": 1670072399999, "60": 1670075999999, "61": 1670079599999, "62": 1670083199999, "63": 1670086799999, "64": 1670090399999, "65": 1670093999999, "66": 1670097599999, "67": 1670101199999, "68": 1670104799999, "69": 1670108399999, "70": 1670111999999, "71": 1670115599999, "72": 1670119199999, "73": 1670122799999, "74": 1670126399999, "75": 1670129999999, "76": 1670133599999, "77": 1670137199999, "78": 1670140799999, "79": 1670144399999, "80": 1670147999999, "81": 1670151599999, "82": 1670155199999, "83": 1670158799999, "84": 1670162399999, "85": 1670165999999, "86": 1670169599999, "87": 1670173199999, "88": 1670176799999, "89": 1670180399999, "90": 1670183999999, "91": 1670187599999, "92": 1670191199999, "93": 1670194799999, "94": 1670198399999, "95": 1670201999999, "96": 1670205599999, "97": 1670209199999, "98": 1670212799999, "99": 1670216399999}, "Close": {"0": 1.0003, "1": 1.0004, "2": 1.0004, "3": 1.0004, "4": 1.0003, "5": 1.0004, "6": 1.0002, "7": 1.0003, "8": 1.0003, "9": 1.0003, "10": 1.0002, "11": 1.0001, "12": 1.0001, "13": 1.0002, "14": 1.0003, "15": 1.0003, "16": 1.0004, "17": 1.0005, "18": 1.0002, "19": 1.0001, "20": 1.0002, "21": 1.0002, "22": 1.0001, "23": 1.0, "24": 1.0, "25": 0.9999, "26": 1.0001, "27": 1.0001, "28": 1.0, "29": 1.0, "30": 1.0001, "31": 1.0, "32": 1.0004, "33": 1.0003, "34": 1.0003, "35": 1.0002, "36": 1.0, "37": 1.0002, "38": 1.0002, "39": 1.0003, "40": 1.0004, "41": 1.0004, "42": 1.0004, "43": 1.0003, "44": 1.0004, "45": 1.0004, "46": 1.0004, "47": 1.0004, "48": 1.0004, "49": 1.0004, "50": 1.0005, "51": 1.0004, "52": 1.0005, "53": 1.0004, "54": 1.0005, "55": 1.0005, "56": 1.0005, "57": 1.0005, "58": 1.0003, "59": 1.0003, "60": 1.0005, "61": 1.0004, "62": 1.0003, "63": 1.0004, "64": 1.0003, "65": 1.0003, "66": 1.0003, "67": 1.0003, "68": 1.0002, "69": 1.0002, "70": 1.0002, "71": 1.0002, "72": 1.0002, "73": 1.0002, "74": 1.0001, "75": 1.0001, "76": 1.0002, "77": 1.0002, "78": 1.0002, "79": 1.0002, "80": 1.0004, "81": 1.0003, "82": 1.0003, "83": 1.0004, "84": 1.0004, "85": 1.0003, "86": 1.0001, "87": 1.0001, "88": 1.0001, "89": 1.0001, "90": 1.0002, "91": 1.0003, "92": 1.0003, "93": 1.0002, "94": 1.0002, "95": 1.0001, "96": 1.0, "97": 1.0, "98": 1.0001, "99": 1.0}}} ], "config": {}, "steps": 768, "volatility_mode": "cccgarch", "maturity": 1.0, "random_seed_price": 42, "random_seed_sigma": 42, "random_seed_black_swan": 42}

In either case, the return value is in JSON format.

The prices key contains two JSON elements: simulated and historical. The simulated key contains a JSON element where each key is one of the assets passed in and the value is a list of simulated prices for each time step. The historical key contains a JSON element where each key is one of the assets passed in and the value is a list of historical prices for each time step.

The volatility key contains two JSON elements: simulated and historical. The simulated key contains a JSON element where each key is one of the assets passed in and the value is a list of simulated volatilities for each time step. The historical key contains a JSON element where each key is one of the assets passed in and the value is a list of historical volatilities for each time step.

The volume key contains only one JSON element at this time: historical. The historical key contains a JSON element where each key is one of the assets passed in and the value is a list of historical volume for each time step.

{
"prices": {
"simulated": {
"<asset1>": [
"list of simulated prices for each time step"
],
"<asset2>": [
"list of simulated prices for each time step"
]
},
"historical": {
"<asset1>": [
"list of historical prices for each time step"
],
"<asset2>": [
"list of historical prices for each time step"
]
}
},
"volatility": {
"simulated": {
"<asset1>": [
"list of simulated volatility for each time step"
],
"<asset2>": [
"list of simulated volatility for each time step"
]
},
"historical": {
"<asset1>": [
"list of historical volatility for each time step"
],
"<asset2>": [
"list of historical volatility for each time step"
]
}
},
"volume": {
"historical": {
"<asset1>": [
"list of historical volume for each time step"
],
"<asset2>": [
"list of historical volume for each time step"
]
}
}
}

/pool/generate

NOTE: THIS ENDPOINT HAS BEEN DEPRECATED AND WILL EVENTUALLY BE REMOVED

Pass in historical asset prices, a price simulator configuration, the number of steps to simulate, the volatility mode, the maturity factor, the clustering metric (euclidean, dtw, or softdtw), the number of separate price simulations to generate, and the clustering size (the number of price groups you want). Receive an HTTP status code indicating success or failure.

The default clustering method, and the one used if none is provided, is euclidean, which is faster since it does not use dynamic time warping but therefore does not account for similar price series that lag.

The default number of price series to generate, if a number is not provided, is 100.

The default number of clusters to generate, if a number is not provided, is 3.

Sample payload:

{"assets": {"BNTUSD": {"Date": {"0": 1669859999999, "1": 1669863599999, "2": 1669867199999, "3": 1669870799999, "4": 1669874399999, "5": 1669877999999, "6": 1669881599999, "7": 1669885199999, "8": 1669888799999, "9": 1669892399999, "10": 1669895999999, "11": 1669899599999, "12": 1669903199999, "13": 1669906799999, "14": 1669910399999, "15": 1669913999999, "16": 1669917599999, "17": 1669921199999, "18": 1669924799999, "19": 1669928399999, "20": 1669931999999, "21": 1669935599999, "22": 1669939199999, "23": 1669942799999, "24": 1669946399999, "25": 1669949999999, "26": 1669953599999, "27": 1669957199999, "28": 1669960799999, "29": 1669964399999, "30": 1669967999999, "31": 1669971599999, "32": 1669975199999, "33": 1669978799999, "34": 1669982399999, "35": 1669985999999, "36": 1669989599999, "37": 1669993199999, "38": 1669996799999, "39": 1670000399999, "40": 1670003999999, "41": 1670007599999, "42": 1670011199999, "43": 1670014799999, "44": 1670018399999, "45": 1670021999999, "46": 1670025599999, "47": 1670029199999, "48": 1670032799999, "49": 1670036399999, "50": 1670039999999, "51": 1670043599999, "52": 1670047199999, "53": 1670050799999, "54": 1670054399999, "55": 1670057999999, "56": 1670061599999, "57": 1670065199999, "58": 1670068799999, "59": 1670072399999, "60": 1670075999999, "61": 1670079599999, "62": 1670083199999, "63": 1670086799999, "64": 1670090399999, "65": 1670093999999, "66": 1670097599999, "67": 1670101199999, "68": 1670104799999, "69": 1670108399999, "70": 1670111999999, "71": 1670115599999, "72": 1670119199999, "73": 1670122799999, "74": 1670126399999, "75": 1670129999999, "76": 1670133599999, "77": 1670137199999, "78": 1670140799999, "79": 1670144399999, "80": 1670147999999, "81": 1670151599999, "82": 1670155199999, "83": 1670158799999, "84": 1670162399999, "85": 1670165999999, "86": 1670169599999, "87": 1670173199999, "88": 1670176799999, "89": 1670180399999, "90": 1670183999999, "91": 1670187599999, "92": 1670191199999, "93": 1670194799999, "94": 1670198399999, "95": 1670201999999, "96": 1670205599999, "97": 1670209199999, "98": 1670212799999, "99": 1670216399999}, "Close": {"0": 0.387, "1": 0.386, "2": 0.387, "3": 0.386, "4": 0.385, "5": 0.385, "6": 0.385, "7": 0.386, "8": 0.386, "9": 0.385, "10": 0.385, "11": 0.391, "12": 0.387, "13": 0.387, "14": 0.383, "15": 0.382, "16": 0.381, "17": 0.381, "18": 0.381, "19": 0.381, "20": 0.381, "21": 0.381, "22": 0.38, "23": 0.383, "24": 0.381, "25": 0.379, "26": 0.379, "27": 0.38, "28": 0.382, "29": 0.382, "30": 0.382, "31": 0.382, "32": 0.382, "33": 0.382, "34": 0.384, "35": 0.383, "36": 0.38, "37": 0.381, "38": 0.382, "39": 0.38, "40": 0.381, "41": 0.381, "42": 0.382, "43": 0.383, "44": 0.384, "45": 0.385, "46": 0.386, "47": 0.386, "48": 0.386, "49": 0.385, "50": 0.385, "51": 0.385, "52": 0.385, "53": 0.382, "54": 0.381, "55": 0.38, "56": 0.38, "57": 0.381, "58": 0.381, "59": 0.381, "60": 0.381, "61": 0.38, "62": 0.382, "63": 0.381, "64": 0.382, "65": 0.381, "66": 0.38, "67": 0.38, "68": 0.378, "69": 0.376, "70": 0.376, "71": 0.378, "72": 0.379, "73": 0.38, "74": 0.379, "75": 0.382, "76": 0.382, "77": 0.382, "78": 0.381, "79": 0.38, "80": 0.379, "81": 0.379, "82": 0.378, "83": 0.379, "84": 0.378, "85": 0.38, "86": 0.382, "87": 0.383, "88": 0.382, "89": 0.383, "90": 0.383, "91": 0.383, "92": 0.383, "93": 0.382, "94": 0.383, "95": 0.383, "96": 0.384, "97": 0.385, "98": 0.385, "99": 0.386}}, "ETHUSD": {"Date": {"0": 1669427999999, "1": 1669431599999, "2": 1669435199999, "3": 1669438799999, "4": 1669442399999, "5": 1669445999999, "6": 1669449599999, "7": 1669453199999, "8": 1669456799999, "9": 1669460399999, "10": 1669463999999, "11": 1669467599999, "12": 1669471199999, "13": 1669474799999, "14": 1669478399999, "15": 1669481999999, "16": 1669485599999, "17": 1669489199999, "18": 1669492799999, "19": 1669496399999, "20": 1669499999999, "21": 1669503599999, "22": 1669507199999, "23": 1669510799999, "24": 1669514399999, "25": 1669517999999, "26": 1669521599999, "27": 1669525199999, "28": 1669528799999, "29": 1669532399999, "30": 1669535999999, "31": 1669539599999, "32": 1669543199999, "33": 1669546799999, "34": 1669550399999, "35": 1669553999999, "36": 1669557599999, "37": 1669561199999, "38": 1669564799999, "39": 1669568399999, "40": 1669571999999, "41": 1669575599999, "42": 1669579199999, "43": 1669582799999, "44": 1669586399999, "45": 1669589999999, "46": 1669593599999, "47": 1669597199999, "48": 1669600799999, "49": 1669604399999, "50": 1669607999999, "51": 1669611599999, "52": 1669615199999, "53": 1669618799999, "54": 1669622399999, "55": 1669625999999, "56": 1669629599999, "57": 1669633199999, "58": 1669636799999, "59": 1669640399999, "60": 1669643999999, "61": 1669647599999, "62": 1669651199999, "63": 1669654799999, "64": 1669658399999, "65": 1669661999999, "66": 1669665599999, "67": 1669669199999, "68": 1669672799999, "69": 1669676399999, "70": 1669679999999, "71": 1669683599999, "72": 1669687199999, "73": 1669690799999, "74": 1669694399999, "75": 1669697999999, "76": 1669701599999, "77": 1669705199999, "78": 1669708799999, "79": 1669712399999, "80": 1669715999999, "81": 1669719599999, "82": 1669723199999, "83": 1669726799999, "84": 1669730399999, "85": 1669733999999, "86": 1669737599999, "87": 1669741199999, "88": 1669744799999, "89": 1669748399999, "90": 1669751999999, "91": 1669755599999, "92": 1669759199999, "93": 1669762799999, "94": 1669766399999, "95": 1669769999999, "96": 1669773599999, "97": 1669777199999, "98": 1669780799999, "99": 1669784399999}, "Close": {"0": 1219.2, "1": 1218.22, "2": 1215.71, "3": 1222.97, "4": 1220.58, "5": 1216.9, "6": 1218.97, "7": 1216.27, "8": 1220.35, "9": 1220.07, "10": 1221.71, "11": 1219.26, "12": 1220.46, "13": 1214.27, "14": 1210.9, "15": 1209.76, "16": 1212.93, "17": 1208.29, "18": 1207.34, "19": 1208.12, "20": 1210.06, "21": 1201.32, "22": 1205.6, "23": 1206.19, "24": 1211.4, "25": 1215.35, "26": 1216.51, "27": 1218.99, "28": 1216.86, "29": 1216.54, "30": 1216.9, "31": 1211.73, "32": 1210.43, "33": 1212.68, "34": 1215.31, "35": 1214.4, "36": 1212.58, "37": 1212.86, "38": 1217.92, "39": 1213.82, "40": 1215.65, "41": 1217.59, "42": 1213.19, "43": 1213.55, "44": 1215.46, "45": 1216.25, "46": 1193.88, "47": 1194.79, "48": 1164.0, "49": 1163.81, "50": 1172.54, "51": 1174.29, "52": 1167.73, "53": 1175.09, "54": 1174.03, "55": 1174.84, "56": 1171.71, "57": 1167.86, "58": 1170.36, "59": 1170.43, "60": 1170.65, "61": 1166.85, "62": 1163.49, "63": 1177.02, "64": 1172.13, "65": 1168.21, "66": 1171.59, "67": 1174.68, "68": 1172.77, "69": 1170.81, "70": 1167.77, "71": 1167.11, "72": 1177.19, "73": 1182.57, "74": 1184.67, "75": 1197.87, "76": 1208.15, "77": 1204.44, "78": 1207.08, "79": 1215.06, "80": 1217.53, "81": 1214.49, "82": 1217.32, "83": 1216.25, "84": 1209.71, "85": 1205.4, "86": 1208.72, "87": 1209.24, "88": 1209.05, "89": 1215.37, "90": 1215.75, "91": 1222.5, "92": 1219.46, "93": 1223.17, "94": 1216.49, "95": 1274.77, "96": 1272.91, "97": 1271.02, "98": 1265.09, "99": 1270.09}}, "LINKUSD": {"Date": {"0": 1669859999999, "1": 1669863599999, "2": 1669867199999, "3": 1669870799999, "4": 1669874399999, "5": 1669877999999, "6": 1669881599999, "7": 1669885199999, "8": 1669888799999, "9": 1669892399999, "10": 1669895999999, "11": 1669899599999, "12": 1669903199999, "13": 1669906799999, "14": 1669910399999, "15": 1669913999999, "16": 1669917599999, "17": 1669921199999, "18": 1669924799999, "19": 1669928399999, "20": 1669931999999, "21": 1669935599999, "22": 1669939199999, "23": 1669942799999, "24": 1669946399999, "25": 1669949999999, "26": 1669953599999, "27": 1669957199999, "28": 1669960799999, "29": 1669964399999, "30": 1669967999999, "31": 1669971599999, "32": 1669975199999, "33": 1669978799999, "34": 1669982399999, "35": 1669985999999, "36": 1669989599999, "37": 1669993199999, "38": 1669996799999, "39": 1670000399999, "40": 1670003999999, "41": 1670007599999, "42": 1670011199999, "43": 1670014799999, "44": 1670018399999, "45": 1670021999999, "46": 1670025599999, "47": 1670029199999, "48": 1670032799999, "49": 1670036399999, "50": 1670039999999, "51": 1670043599999, "52": 1670047199999, "53": 1670050799999, "54": 1670054399999, "55": 1670057999999, "56": 1670061599999, "57": 1670065199999, "58": 1670068799999, "59": 1670072399999, "60": 1670075999999, "61": 1670079599999, "62": 1670083199999, "63": 1670086799999, "64": 1670090399999, "65": 1670093999999, "66": 1670097599999, "67": 1670101199999, "68": 1670104799999, "69": 1670108399999, "70": 1670111999999, "71": 1670115599999, "72": 1670119199999, "73": 1670122799999, "74": 1670126399999, "75": 1670129999999, "76": 1670133599999, "77": 1670137199999, "78": 1670140799999, "79": 1670144399999, "80": 1670147999999, "81": 1670151599999, "82": 1670155199999, "83": 1670158799999, "84": 1670162399999, "85": 1670165999999, "86": 1670169599999, "87": 1670173199999, "88": 1670176799999, "89": 1670180399999, "90": 1670183999999, "91": 1670187599999, "92": 1670191199999, "93": 1670194799999, "94": 1670198399999, "95": 1670201999999, "96": 1670205599999, "97": 1670209199999, "98": 1670212799999, "99": 1670216399999}, "Close": {"0": 7.565, "1": 7.58, "2": 7.58, "3": 7.547, "4": 7.535, "5": 7.556, "6": 7.514, "7": 7.548, "8": 7.539, "9": 7.539, "10": 7.549, "11": 7.592, "12": 7.56, "13": 7.696, "14": 7.7, "15": 7.645, "16": 7.616, "17": 7.573, "18": 7.634, "19": 7.61, "20": 7.699, "21": 7.746, "22": 7.681, "23": 7.689, "24": 7.67, "25": 7.643, "26": 7.596, "27": 7.6, "28": 7.609, "29": 7.569, "30": 7.581, "31": 7.591, "32": 7.597, "33": 7.605, "34": 7.627, "35": 7.643, "36": 7.579, "37": 7.588, "38": 7.565, "39": 7.561, "40": 7.573, "41": 7.537, "42": 7.593, "43": 7.619, "44": 7.611, "45": 7.584, "46": 7.61, "47": 7.526, "48": 7.49, "49": 7.458, "50": 7.492, "51": 7.484, "52": 7.452, "53": 7.425, "54": 7.451, "55": 7.405, "56": 7.428, "57": 7.415, "58": 7.428, "59": 7.452, "60": 7.441, "61": 7.409, "62": 7.415, "63": 7.373, "64": 7.395, "65": 7.378, "66": 7.321, "67": 7.328, "68": 7.341, "69": 7.255, "70": 7.235, "71": 7.291, "72": 7.241, "73": 7.307, "74": 7.309, "75": 7.364, "76": 7.368, "77": 7.356, "78": 7.347, "79": 7.338, "80": 7.378, "81": 7.33, "82": 7.292, "83": 7.354, "84": 7.306, "85": 7.341, "86": 7.351, "87": 7.317, "88": 7.343, "89": 7.382, "90": 7.372, "91": 7.376, "92": 7.393, "93": 7.407, "94": 7.444, "95": 7.492, "96": 7.522, "97": 7.516, "98": 7.521, "99": 7.552}}, "USDDAI": {"Date": {"0": 1669859999999, "1": 1669863599999, "2": 1669867199999, "3": 1669870799999, "4": 1669874399999, "5": 1669877999999, "6": 1669881599999, "7": 1669885199999, "8": 1669888799999, "9": 1669892399999, "10": 1669895999999, "11": 1669899599999, "12": 1669903199999, "13": 1669906799999, "14": 1669910399999, "15": 1669913999999, "16": 1669917599999, "17": 1669921199999, "18": 1669924799999, "19": 1669928399999, "20": 1669931999999, "21": 1669935599999, "22": 1669939199999, "23": 1669942799999, "24": 1669946399999, "25": 1669949999999, "26": 1669953599999, "27": 1669957199999, "28": 1669960799999, "29": 1669964399999, "30": 1669967999999, "31": 1669971599999, "32": 1669975199999, "33": 1669978799999, "34": 1669982399999, "35": 1669985999999, "36": 1669989599999, "37": 1669993199999, "38": 1669996799999, "39": 1670000399999, "40": 1670003999999, "41": 1670007599999, "42": 1670011199999, "43": 1670014799999, "44": 1670018399999, "45": 1670021999999, "46": 1670025599999, "47": 1670029199999, "48": 1670032799999, "49": 1670036399999, "50": 1670039999999, "51": 1670043599999, "52": 1670047199999, "53": 1670050799999, "54": 1670054399999, "55": 1670057999999, "56": 1670061599999, "57": 1670065199999, "58": 1670068799999, "59": 1670072399999, "60": 1670075999999, "61": 1670079599999, "62": 1670083199999, "63": 1670086799999, "64": 1670090399999, "65": 1670093999999, "66": 1670097599999, "67": 1670101199999, "68": 1670104799999, "69": 1670108399999, "70": 1670111999999, "71": 1670115599999, "72": 1670119199999, "73": 1670122799999, "74": 1670126399999, "75": 1670129999999, "76": 1670133599999, "77": 1670137199999, "78": 1670140799999, "79": 1670144399999, "80": 1670147999999, "81": 1670151599999, "82": 1670155199999, "83": 1670158799999, "84": 1670162399999, "85": 1670165999999, "86": 1670169599999, "87": 1670173199999, "88": 1670176799999, "89": 1670180399999, "90": 1670183999999, "91": 1670187599999, "92": 1670191199999, "93": 1670194799999, "94": 1670198399999, "95": 1670201999999, "96": 1670205599999, "97": 1670209199999, "98": 1670212799999, "99": 1670216399999}, "Close": {"0": 1.0003, "1": 1.0004, "2": 1.0004, "3": 1.0004, "4": 1.0003, "5": 1.0004, "6": 1.0002, "7": 1.0003, "8": 1.0003, "9": 1.0003, "10": 1.0002, "11": 1.0001, "12": 1.0001, "13": 1.0002, "14": 1.0003, "15": 1.0003, "16": 1.0004, "17": 1.0005, "18": 1.0002, "19": 1.0001, "20": 1.0002, "21": 1.0002, "22": 1.0001, "23": 1.0, "24": 1.0, "25": 0.9999, "26": 1.0001, "27": 1.0001, "28": 1.0, "29": 1.0, "30": 1.0001, "31": 1.0, "32": 1.0004, "33": 1.0003, "34": 1.0003, "35": 1.0002, "36": 1.0, "37": 1.0002, "38": 1.0002, "39": 1.0003, "40": 1.0004, "41": 1.0004, "42": 1.0004, "43": 1.0003, "44": 1.0004, "45": 1.0004, "46": 1.0004, "47": 1.0004, "48": 1.0004, "49": 1.0004, "50": 1.0005, "51": 1.0004, "52": 1.0005, "53": 1.0004, "54": 1.0005, "55": 1.0005, "56": 1.0005, "57": 1.0005, "58": 1.0003, "59": 1.0003, "60": 1.0005, "61": 1.0004, "62": 1.0003, "63": 1.0004, "64": 1.0003, "65": 1.0003, "66": 1.0003, "67": 1.0003, "68": 1.0002, "69": 1.0002, "70": 1.0002, "71": 1.0002, "72": 1.0002, "73": 1.0002, "74": 1.0001, "75": 1.0001, "76": 1.0002, "77": 1.0002, "78": 1.0002, "79": 1.0002, "80": 1.0004, "81": 1.0003, "82": 1.0003, "83": 1.0004, "84": 1.0004, "85": 1.0003, "86": 1.0001, "87": 1.0001, "88": 1.0001, "89": 1.0001, "90": 1.0002, "91": 1.0003, "92": 1.0003, "93": 1.0002, "94": 1.0002, "95": 1.0001, "96": 1.0, "97": 1.0, "98": 1.0001, "99": 1.0}}}, "config": {}, "steps": 768, "volatility_mode": "cccgarch", "maturity": 1.0, "cluster_metric": "euclidean", "population_size": 100, "clusters": 3}

Returns HTTP 201 Created if the pool is generated. Any other status code should be interpreted as a failure.

/pool/sample

Pass in historical asset prices, a price simulator configuration, the number of steps to simulate, the volatility mode, the maturity factor, and the cluster from which to sample. Receive a price simulation from the provided cluster or an error code if the cluster value is invalid.

Sample payload:

{"assets": {"BNTUSD": {"Date": {"0": 1669859999999, "1": 1669863599999, "2": 1669867199999, "3": 1669870799999, "4": 1669874399999, "5": 1669877999999, "6": 1669881599999, "7": 1669885199999, "8": 1669888799999, "9": 1669892399999, "10": 1669895999999, "11": 1669899599999, "12": 1669903199999, "13": 1669906799999, "14": 1669910399999, "15": 1669913999999, "16": 1669917599999, "17": 1669921199999, "18": 1669924799999, "19": 1669928399999, "20": 1669931999999, "21": 1669935599999, "22": 1669939199999, "23": 1669942799999, "24": 1669946399999, "25": 1669949999999, "26": 1669953599999, "27": 1669957199999, "28": 1669960799999, "29": 1669964399999, "30": 1669967999999, "31": 1669971599999, "32": 1669975199999, "33": 1669978799999, "34": 1669982399999, "35": 1669985999999, "36": 1669989599999, "37": 1669993199999, "38": 1669996799999, "39": 1670000399999, "40": 1670003999999, "41": 1670007599999, "42": 1670011199999, "43": 1670014799999, "44": 1670018399999, "45": 1670021999999, "46": 1670025599999, "47": 1670029199999, "48": 1670032799999, "49": 1670036399999, "50": 1670039999999, "51": 1670043599999, "52": 1670047199999, "53": 1670050799999, "54": 1670054399999, "55": 1670057999999, "56": 1670061599999, "57": 1670065199999, "58": 1670068799999, "59": 1670072399999, "60": 1670075999999, "61": 1670079599999, "62": 1670083199999, "63": 1670086799999, "64": 1670090399999, "65": 1670093999999, "66": 1670097599999, "67": 1670101199999, "68": 1670104799999, "69": 1670108399999, "70": 1670111999999, "71": 1670115599999, "72": 1670119199999, "73": 1670122799999, "74": 1670126399999, "75": 1670129999999, "76": 1670133599999, "77": 1670137199999, "78": 1670140799999, "79": 1670144399999, "80": 1670147999999, "81": 1670151599999, "82": 1670155199999, "83": 1670158799999, "84": 1670162399999, "85": 1670165999999, "86": 1670169599999, "87": 1670173199999, "88": 1670176799999, "89": 1670180399999, "90": 1670183999999, "91": 1670187599999, "92": 1670191199999, "93": 1670194799999, "94": 1670198399999, "95": 1670201999999, "96": 1670205599999, "97": 1670209199999, "98": 1670212799999, "99": 1670216399999}, "Close": {"0": 0.387, "1": 0.386, "2": 0.387, "3": 0.386, "4": 0.385, "5": 0.385, "6": 0.385, "7": 0.386, "8": 0.386, "9": 0.385, "10": 0.385, "11": 0.391, "12": 0.387, "13": 0.387, "14": 0.383, "15": 0.382, "16": 0.381, "17": 0.381, "18": 0.381, "19": 0.381, "20": 0.381, "21": 0.381, "22": 0.38, "23": 0.383, "24": 0.381, "25": 0.379, "26": 0.379, "27": 0.38, "28": 0.382, "29": 0.382, "30": 0.382, "31": 0.382, "32": 0.382, "33": 0.382, "34": 0.384, "35": 0.383, "36": 0.38, "37": 0.381, "38": 0.382, "39": 0.38, "40": 0.381, "41": 0.381, "42": 0.382, "43": 0.383, "44": 0.384, "45": 0.385, "46": 0.386, "47": 0.386, "48": 0.386, "49": 0.385, "50": 0.385, "51": 0.385, "52": 0.385, "53": 0.382, "54": 0.381, "55": 0.38, "56": 0.38, "57": 0.381, "58": 0.381, "59": 0.381, "60": 0.381, "61": 0.38, "62": 0.382, "63": 0.381, "64": 0.382, "65": 0.381, "66": 0.38, "67": 0.38, "68": 0.378, "69": 0.376, "70": 0.376, "71": 0.378, "72": 0.379, "73": 0.38, "74": 0.379, "75": 0.382, "76": 0.382, "77": 0.382, "78": 0.381, "79": 0.38, "80": 0.379, "81": 0.379, "82": 0.378, "83": 0.379, "84": 0.378, "85": 0.38, "86": 0.382, "87": 0.383, "88": 0.382, "89": 0.383, "90": 0.383, "91": 0.383, "92": 0.383, "93": 0.382, "94": 0.383, "95": 0.383, "96": 0.384, "97": 0.385, "98": 0.385, "99": 0.386}}, "ETHUSD": {"Date": {"0": 1669427999999, "1": 1669431599999, "2": 1669435199999, "3": 1669438799999, "4": 1669442399999, "5": 1669445999999, "6": 1669449599999, "7": 1669453199999, "8": 1669456799999, "9": 1669460399999, "10": 1669463999999, "11": 1669467599999, "12": 1669471199999, "13": 1669474799999, "14": 1669478399999, "15": 1669481999999, "16": 1669485599999, "17": 1669489199999, "18": 1669492799999, "19": 1669496399999, "20": 1669499999999, "21": 1669503599999, "22": 1669507199999, "23": 1669510799999, "24": 1669514399999, "25": 1669517999999, "26": 1669521599999, "27": 1669525199999, "28": 1669528799999, "29": 1669532399999, "30": 1669535999999, "31": 1669539599999, "32": 1669543199999, "33": 1669546799999, "34": 1669550399999, "35": 1669553999999, "36": 1669557599999, "37": 1669561199999, "38": 1669564799999, "39": 1669568399999, "40": 1669571999999, "41": 1669575599999, "42": 1669579199999, "43": 1669582799999, "44": 1669586399999, "45": 1669589999999, "46": 1669593599999, "47": 1669597199999, "48": 1669600799999, "49": 1669604399999, "50": 1669607999999, "51": 1669611599999, "52": 1669615199999, "53": 1669618799999, "54": 1669622399999, "55": 1669625999999, "56": 1669629599999, "57": 1669633199999, "58": 1669636799999, "59": 1669640399999, "60": 1669643999999, "61": 1669647599999, "62": 1669651199999, "63": 1669654799999, "64": 1669658399999, "65": 1669661999999, "66": 1669665599999, "67": 1669669199999, "68": 1669672799999, "69": 1669676399999, "70": 1669679999999, "71": 1669683599999, "72": 1669687199999, "73": 1669690799999, "74": 1669694399999, "75": 1669697999999, "76": 1669701599999, "77": 1669705199999, "78": 1669708799999, "79": 1669712399999, "80": 1669715999999, "81": 1669719599999, "82": 1669723199999, "83": 1669726799999, "84": 1669730399999, "85": 1669733999999, "86": 1669737599999, "87": 1669741199999, "88": 1669744799999, "89": 1669748399999, "90": 1669751999999, "91": 1669755599999, "92": 1669759199999, "93": 1669762799999, "94": 1669766399999, "95": 1669769999999, "96": 1669773599999, "97": 1669777199999, "98": 1669780799999, "99": 1669784399999}, "Close": {"0": 1219.2, "1": 1218.22, "2": 1215.71, "3": 1222.97, "4": 1220.58, "5": 1216.9, "6": 1218.97, "7": 1216.27, "8": 1220.35, "9": 1220.07, "10": 1221.71, "11": 1219.26, "12": 1220.46, "13": 1214.27, "14": 1210.9, "15": 1209.76, "16": 1212.93, "17": 1208.29, "18": 1207.34, "19": 1208.12, "20": 1210.06, "21": 1201.32, "22": 1205.6, "23": 1206.19, "24": 1211.4, "25": 1215.35, "26": 1216.51, "27": 1218.99, "28": 1216.86, "29": 1216.54, "30": 1216.9, "31": 1211.73, "32": 1210.43, "33": 1212.68, "34": 1215.31, "35": 1214.4, "36": 1212.58, "37": 1212.86, "38": 1217.92, "39": 1213.82, "40": 1215.65, "41": 1217.59, "42": 1213.19, "43": 1213.55, "44": 1215.46, "45": 1216.25, "46": 1193.88, "47": 1194.79, "48": 1164.0, "49": 1163.81, "50": 1172.54, "51": 1174.29, "52": 1167.73, "53": 1175.09, "54": 1174.03, "55": 1174.84, "56": 1171.71, "57": 1167.86, "58": 1170.36, "59": 1170.43, "60": 1170.65, "61": 1166.85, "62": 1163.49, "63": 1177.02, "64": 1172.13, "65": 1168.21, "66": 1171.59, "67": 1174.68, "68": 1172.77, "69": 1170.81, "70": 1167.77, "71": 1167.11, "72": 1177.19, "73": 1182.57, "74": 1184.67, "75": 1197.87, "76": 1208.15, "77": 1204.44, "78": 1207.08, "79": 1215.06, "80": 1217.53, "81": 1214.49, "82": 1217.32, "83": 1216.25, "84": 1209.71, "85": 1205.4, "86": 1208.72, "87": 1209.24, "88": 1209.05, "89": 1215.37, "90": 1215.75, "91": 1222.5, "92": 1219.46, "93": 1223.17, "94": 1216.49, "95": 1274.77, "96": 1272.91, "97": 1271.02, "98": 1265.09, "99": 1270.09}}, "LINKUSD": {"Date": {"0": 1669859999999, "1": 1669863599999, "2": 1669867199999, "3": 1669870799999, "4": 1669874399999, "5": 1669877999999, "6": 1669881599999, "7": 1669885199999, "8": 1669888799999, "9": 1669892399999, "10": 1669895999999, "11": 1669899599999, "12": 1669903199999, "13": 1669906799999, "14": 1669910399999, "15": 1669913999999, "16": 1669917599999, "17": 1669921199999, "18": 1669924799999, "19": 1669928399999, "20": 1669931999999, "21": 1669935599999, "22": 1669939199999, "23": 1669942799999, "24": 1669946399999, "25": 1669949999999, "26": 1669953599999, "27": 1669957199999, "28": 1669960799999, "29": 1669964399999, "30": 1669967999999, "31": 1669971599999, "32": 1669975199999, "33": 1669978799999, "34": 1669982399999, "35": 1669985999999, "36": 1669989599999, "37": 1669993199999, "38": 1669996799999, "39": 1670000399999, "40": 1670003999999, "41": 1670007599999, "42": 1670011199999, "43": 1670014799999, "44": 1670018399999, "45": 1670021999999, "46": 1670025599999, "47": 1670029199999, "48": 1670032799999, "49": 1670036399999, "50": 1670039999999, "51": 1670043599999, "52": 1670047199999, "53": 1670050799999, "54": 1670054399999, "55": 1670057999999, "56": 1670061599999, "57": 1670065199999, "58": 1670068799999, "59": 1670072399999, "60": 1670075999999, "61": 1670079599999, "62": 1670083199999, "63": 1670086799999, "64": 1670090399999, "65": 1670093999999, "66": 1670097599999, "67": 1670101199999, "68": 1670104799999, "69": 1670108399999, "70": 1670111999999, "71": 1670115599999, "72": 1670119199999, "73": 1670122799999, "74": 1670126399999, "75": 1670129999999, "76": 1670133599999, "77": 1670137199999, "78": 1670140799999, "79": 1670144399999, "80": 1670147999999, "81": 1670151599999, "82": 1670155199999, "83": 1670158799999, "84": 1670162399999, "85": 1670165999999, "86": 1670169599999, "87": 1670173199999, "88": 1670176799999, "89": 1670180399999, "90": 1670183999999, "91": 1670187599999, "92": 1670191199999, "93": 1670194799999, "94": 1670198399999, "95": 1670201999999, "96": 1670205599999, "97": 1670209199999, "98": 1670212799999, "99": 1670216399999}, "Close": {"0": 7.565, "1": 7.58, "2": 7.58, "3": 7.547, "4": 7.535, "5": 7.556, "6": 7.514, "7": 7.548, "8": 7.539, "9": 7.539, "10": 7.549, "11": 7.592, "12": 7.56, "13": 7.696, "14": 7.7, "15": 7.645, "16": 7.616, "17": 7.573, "18": 7.634, "19": 7.61, "20": 7.699, "21": 7.746, "22": 7.681, "23": 7.689, "24": 7.67, "25": 7.643, "26": 7.596, "27": 7.6, "28": 7.609, "29": 7.569, "30": 7.581, "31": 7.591, "32": 7.597, "33": 7.605, "34": 7.627, "35": 7.643, "36": 7.579, "37": 7.588, "38": 7.565, "39": 7.561, "40": 7.573, "41": 7.537, "42": 7.593, "43": 7.619, "44": 7.611, "45": 7.584, "46": 7.61, "47": 7.526, "48": 7.49, "49": 7.458, "50": 7.492, "51": 7.484, "52": 7.452, "53": 7.425, "54": 7.451, "55": 7.405, "56": 7.428, "57": 7.415, "58": 7.428, "59": 7.452, "60": 7.441, "61": 7.409, "62": 7.415, "63": 7.373, "64": 7.395, "65": 7.378, "66": 7.321, "67": 7.328, "68": 7.341, "69": 7.255, "70": 7.235, "71": 7.291, "72": 7.241, "73": 7.307, "74": 7.309, "75": 7.364, "76": 7.368, "77": 7.356, "78": 7.347, "79": 7.338, "80": 7.378, "81": 7.33, "82": 7.292, "83": 7.354, "84": 7.306, "85": 7.341, "86": 7.351, "87": 7.317, "88": 7.343, "89": 7.382, "90": 7.372, "91": 7.376, "92": 7.393, "93": 7.407, "94": 7.444, "95": 7.492, "96": 7.522, "97": 7.516, "98": 7.521, "99": 7.552}}, "USDDAI": {"Date": {"0": 1669859999999, "1": 1669863599999, "2": 1669867199999, "3": 1669870799999, "4": 1669874399999, "5": 1669877999999, "6": 1669881599999, "7": 1669885199999, "8": 1669888799999, "9": 1669892399999, "10": 1669895999999, "11": 1669899599999, "12": 1669903199999, "13": 1669906799999, "14": 1669910399999, "15": 1669913999999, "16": 1669917599999, "17": 1669921199999, "18": 1669924799999, "19": 1669928399999, "20": 1669931999999, "21": 1669935599999, "22": 1669939199999, "23": 1669942799999, "24": 1669946399999, "25": 1669949999999, "26": 1669953599999, "27": 1669957199999, "28": 1669960799999, "29": 1669964399999, "30": 1669967999999, "31": 1669971599999, "32": 1669975199999, "33": 1669978799999, "34": 1669982399999, "35": 1669985999999, "36": 1669989599999, "37": 1669993199999, "38": 1669996799999, "39": 1670000399999, "40": 1670003999999, "41": 1670007599999, "42": 1670011199999, "43": 1670014799999, "44": 1670018399999, "45": 1670021999999, "46": 1670025599999, "47": 1670029199999, "48": 1670032799999, "49": 1670036399999, "50": 1670039999999, "51": 1670043599999, "52": 1670047199999, "53": 1670050799999, "54": 1670054399999, "55": 1670057999999, "56": 1670061599999, "57": 1670065199999, "58": 1670068799999, "59": 1670072399999, "60": 1670075999999, "61": 1670079599999, "62": 1670083199999, "63": 1670086799999, "64": 1670090399999, "65": 1670093999999, "66": 1670097599999, "67": 1670101199999, "68": 1670104799999, "69": 1670108399999, "70": 1670111999999, "71": 1670115599999, "72": 1670119199999, "73": 1670122799999, "74": 1670126399999, "75": 1670129999999, "76": 1670133599999, "77": 1670137199999, "78": 1670140799999, "79": 1670144399999, "80": 1670147999999, "81": 1670151599999, "82": 1670155199999, "83": 1670158799999, "84": 1670162399999, "85": 1670165999999, "86": 1670169599999, "87": 1670173199999, "88": 1670176799999, "89": 1670180399999, "90": 1670183999999, "91": 1670187599999, "92": 1670191199999, "93": 1670194799999, "94": 1670198399999, "95": 1670201999999, "96": 1670205599999, "97": 1670209199999, "98": 1670212799999, "99": 1670216399999}, "Close": {"0": 1.0003, "1": 1.0004, "2": 1.0004, "3": 1.0004, "4": 1.0003, "5": 1.0004, "6": 1.0002, "7": 1.0003, "8": 1.0003, "9": 1.0003, "10": 1.0002, "11": 1.0001, "12": 1.0001, "13": 1.0002, "14": 1.0003, "15": 1.0003, "16": 1.0004, "17": 1.0005, "18": 1.0002, "19": 1.0001, "20": 1.0002, "21": 1.0002, "22": 1.0001, "23": 1.0, "24": 1.0, "25": 0.9999, "26": 1.0001, "27": 1.0001, "28": 1.0, "29": 1.0, "30": 1.0001, "31": 1.0, "32": 1.0004, "33": 1.0003, "34": 1.0003, "35": 1.0002, "36": 1.0, "37": 1.0002, "38": 1.0002, "39": 1.0003, "40": 1.0004, "41": 1.0004, "42": 1.0004, "43": 1.0003, "44": 1.0004, "45": 1.0004, "46": 1.0004, "47": 1.0004, "48": 1.0004, "49": 1.0004, "50": 1.0005, "51": 1.0004, "52": 1.0005, "53": 1.0004, "54": 1.0005, "55": 1.0005, "56": 1.0005, "57": 1.0005, "58": 1.0003, "59": 1.0003, "60": 1.0005, "61": 1.0004, "62": 1.0003, "63": 1.0004, "64": 1.0003, "65": 1.0003, "66": 1.0003, "67": 1.0003, "68": 1.0002, "69": 1.0002, "70": 1.0002, "71": 1.0002, "72": 1.0002, "73": 1.0002, "74": 1.0001, "75": 1.0001, "76": 1.0002, "77": 1.0002, "78": 1.0002, "79": 1.0002, "80": 1.0004, "81": 1.0003, "82": 1.0003, "83": 1.0004, "84": 1.0004, "85": 1.0003, "86": 1.0001, "87": 1.0001, "88": 1.0001, "89": 1.0001, "90": 1.0002, "91": 1.0003, "92": 1.0003, "93": 1.0002, "94": 1.0002, "95": 1.0001, "96": 1.0, "97": 1.0, "98": 1.0001, "99": 1.0}}}, "config": {}, "steps": 768, "volatility_mode": "cccgarch", "maturity": 1.0, "cluster": 0}

Return format, where the prices key contains a JSON element where each key is one of the assets passed in and the value is a list of simulated prices for each time step:

{
"prices": {
"<asset1>": [
"list of prices for each time step"
],
"<asset2>": [
"list of prices for each time step"
]
}
}

If the cluster parameter in the request is invalid, then HTTP 418 I'm a teapot will be returned.

Script

To run the price simulator as a standalone script, the following command can be used:

python price_simulator.py

To control the volatility mode (note that CCC-GARCH is the default), provide the mode parameter:

python price_simulator.py --mode=cccgarch
python price_simulator.py --mode=constant

To control the number of time steps (note that 14,400 is the default, as this translates to one full day in which one block represents six seconds), provide the steps parameter:

python price_simulator.py --steps=500