Cached

cached(ttl: int, respect: str =’order_pos’)(cached_value: str)

Function that is typically used for caching equitation results of cached_value formula.

cached_value string representation is used as a key for cache

ttl positive integer which is defines time-to-live for cache

respect one of (default order_pos):

  • order_pos - calculate cached_value for each order in grid

  • grid - calculate cached_value for the whole grid

  • bot - calculate cached_value for the whole bot

  • global - calculate cached_value . Results are used for all bots

respect=”order_pos” must not be used with update_balance_formula inside group and bot

respect=”grid” must not be used with update_balance_formula inside group and bot

respect=”bot” must not be used with update_balance_formula inside group

respect='order_pos' orders are the same during ttl seconds

respect='grid' all orders are placed with the same inside one grid during ttl seconds

Grids must exist to use this type of cache due to the need to get the grid.id

but the price changes between grids

respect='bot' all orders are placed with the same over the all grids in one bot during ttl seconds *Warning: bot must exist to use this type of cache due to the need to get the bot.id

respect='global' all orders are placed with the same over the all bots during ttl seconds

Example:

Last updated