pyokx.rest_messages_service

async pyokx.rest_messages_service.analyze_transaction_history(InstTypes: List[InstType] = ['FUTURES', 'SWAP'])[source]

Analyzes the transaction history for a given instrument type over the last 90 days.

This function fetches the fill history, calculates various metrics for different timeframes, and stores the results in a Redis stream.

Parameters:

InstTypes (List[InstType]) – The type of instruments to analyze (e.g., ‘FUTURES’). Default is [‘FUTURES’, ‘SWAP’].

async pyokx.rest_messages_service.loop_fetch_incomplete_algo_orders(reload_interval: int = 0.2)[source]
async pyokx.rest_messages_service.loop_fetch_incomplete_orders(reload_interval: int = 0.2)[source]
async pyokx.rest_messages_service.okx_rest_messages_services(slow_reload_interval: int = 30)[source]

Main service loop for processing OKX REST messages.

This function initializes the Redis connection and enters a loop that, at each interval, calls analyze_transaction_history to analyze and store the last 90 days of transaction history. Handles exceptions and logs them accordingly.

Parameters:

slow_reload_interval (int) – The interval in seconds between each iteration of the loop. Default is 30 seconds.

async pyokx.rest_messages_service.slow_polling_service(reload_interval: int = 30)[source]
async pyokx.rest_messages_service.update_instruments(okx_instrument_searcher: InstrumentSearcher)[source]