Cached
Understand how the Cached function in Origami Tech temporarily stores computed data to reduce recalculation time and optimize strategy performance.
cached(ttl: int, respect: str =’order_pos’)(cached_value: str)
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- calculatecached_valuefor each order in gridgrid- calculatecached_valuefor the whole gridbot- calculatecached_valuefor the whole botglobal- calculatecached_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