Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Live Trading #13

Open
Emsu opened this issue Jan 11, 2015 · 1 comment
Open

[Proposal] Live Trading #13

Emsu opened this issue Jan 11, 2015 · 1 comment

Comments

@Emsu
Copy link
Owner

Emsu commented Jan 11, 2015

Please feel free to comment on this proposal if you have any questions/changes/ideas. If you'd like to help on anything, feel free to comment on this thread and tag me.

Goal

Create an interface that allows users to potentially live trade using Prophet. This interface should be modular to allow users to use a variety of different trading API connectors.

Implementation

The initial implementation should consist of two parts. The first part should be changes to the core library to allow Prophet to accept live data from multiple data sources and output orders in different formats as a stream. The second part will be an initial reference implementation of a FIX connector to allow Prophet to accept input data over FIX and output orders to a FIX API.

Accepting Data

The proposed implementation for accepting live data from multiple DataGenerators is to use the multiprocessing library and distribute the generators to multiple processes. The Prophet library will use a thread safe queue to accept input data from these processes and ask the OrderGenerator if an order should be generated from the new data. DataGenerators will now provide a run_live method for generating live data which will be appended to the end of the dataset generated by run. The DataGenerator class itself will have a noop run_live function (basically assumes there is no live data).

Generating Orders

Currently, orders are generated and processed by a backtest and only the backtest result is outputted. For live trading, we will need a daemonizable Prophet function (live_trade?) which will accept live data from DataGenerators and yield lists of Orders to a connector. This will equate to something along the lines of connector.receive([Order(), Order()]). It will be up to the connector to decide what to do with it. The connector should be able to optionally return what price the orders were filled at or whether the orders were filled at all. Connectors could also be used for debugging or other purposes (eg. just print the orders it receives).

FIX Connectors

An order connector and data generator should be written to provide examples of how to write Prophet connectors. Currently the most promising library seems to be quickfix. The data generator should be a simple python generator that outputs formatted data received the FIX API. The order generator should submit orders via the FIX API and return metadata about orders as they are filled.

@Emsu Emsu mentioned this issue Jan 11, 2015
@Emsu Emsu closed this as completed Jan 11, 2015
@Emsu Emsu reopened this Jan 11, 2015
@Emsu
Copy link
Owner Author

Emsu commented Jan 11, 2015

@asiviero I was imagining you working on the FIX Connectors, but if you're busy, don't worry about it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant