Gym_exchange#
To use AlphaTrade, first install it using pip:
(.venv) $ pip install gym_exchange
To retrieve a list of random ingredients,
you can use the gym_exchange.make() function:
For example:
>>> import gym_exchange
>>> gym_exchange.make()
data_orderbook_adapter#
outlines for the codes#
1 data_pipeline.py used for defining the data path of your reading data. You should config it before runnning.
- 2
decoder.pyis used for transferring the data into the trading signals decoder = Decoder(**DataPipeline()())hereDataPipeline()genereate an instance.DataPipeline()()call the__call__()method.**DataPipeline()()unpack the return tuple of the__call__()method of class DataPipeline.signals_list = decoder.process()theprocess()`is the main method which would be used in the class Decoder. Heredecoderis an instance ofDecoder.- Four major components:
InsideSignal,OutsideSignal,SignalPorcessor, andDataAdjuster - the
trading signalsis produce by two parts:InsideSignalEncoderandOutsideSignalEncoder the
InsideSignalmeans the trading signals inside the price level (e.g. 10 for our example data)the
OutsideSignalmeans the trading signals outside the price level (e.g. 10 for our example data)SignalPorcessoris a class used to ensure the trading signals is right by executing the trading signals and then get the orderbook and then compare the generated orderbook with the l2 data.
- the
- class
DataAdjusteris another important part of the decoder, which helpsadjust_data_drift. It means that the l2 and l3 data may contains different info, and this class is usd for extracting the useful info which might be in the l2 data, but not l3. e.g. some order is partly cancelled outside the price level
- class
- Four major components:
- 3
encoder.pyis used for transfer thetrading signalsintoorder flows, the later is machine-readable for the packageorderbook/jaxob >>> decoder = Decoder(**DataPipeline()()) >>> encoder = Encoder(decoder) >>> Ofs = encoder()