Git Product home page Git Product logo

sumzerotrading's Introduction

Sum Zero Trading API alt

Java API for developing automated trading applications which includes support for:

  • connecting to Interactive Brokers for placing trades, subscribing to market data, and historical data.
  • connecting to Quantitative Brokers for placing trades.
  • connecting to Collective2 for placing trades.

TODO

  • Configure release builds to deploy to maven central
  • JavaDocs

Author:
Rob Terpilowski - Links:
twitter: @RobTerpilowski
twitter: @SumZeroTrading
LinkedIn: Rob Terpilowski
GitHub: Rob Terpilowski

sumzerotrading's People

Contributors

rterp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sumzerotrading's Issues

Undefined Java Methods Found in Example Project

Hi,
I have found that the example projects EODTradingStrategy and IntradayTradingExample contains the undefined java methods(attached).

If you have the latest copies of these projects, kindly upload to the repositories.

Cheer,
Vincent Yap
screen shot 2016-06-20 at 3 10 11 pm

Build fails to find IB-api 9.73?

Failed with the message:

Could not resolve dependencies for project com.sumzerotrading:sumzero-ib-common-api:jar:0.1.7-SNAPSHOT: Failure to find com.ib:interactive-brokers-api:jar:9.73 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

Apparently maven only has https://repo.maven.apache.org/maven2/com/interactivebrokers/tws/tws-api/9.72.05/

IB RealTime Bar Builder stops working after an order is placed

After an order is placed for a ticker the real-time bar builder will return the same OHLC data from the time the order is placed. It appears the Level1QuoteListener stops receiving events for that Ticker after an order for that Ticker is executed.

How to use this API?

Hi,

I have previously used the IB API by itself but am now looking to switch to this one. How do I run the example files? I have just downloaded all the files. Is there some sort of preparation I need to do beforehand? Currently, I am using Eclipse and it is not finding any of the imports from the SumZeroTrading API.

Thanks

Automatically reconnect to TWS

When TWS is closed the EReader.run() method throws a java.io.EOFException, and the trading program stops execution. When TWS is restarted, the trading program must be restarted in order to reconnect to TWS. Update the Interactive Brokers classes to automatically reconnect to TWS when it is online again.

Get orders that were placed during a previous API session.

It appears that if an API application places an order, and then TWS and the API app are shut down and started again, and then the order is filled, the API application does not receive an order status event for the order. Find out how to get order events that were placed during previous API sessions.

IB Disconnection

I have noticed that there are some threads running after calling the InteractiveBrokersClientInterface.unsubscribeLevel1() method as well as
InteractiveBrokersClientInterface.disconnect(). Are there any methods which can be used to close the running threads after the connect() method and subscribeLevel1() method?

intraday.props and strategy directory

Hi,
I would like to test out your API but could not find the properties files(e.g. intraday.props...) in your repository. Would you mind attach it here?
Besides, I have noticed it is required to set the StrategyDirectory. How is the format of the strategy file stored in this directory?

Many thanks.
Best Regards,
Vincent Yap

TradeOrder class does not always serialize/deserialize properly

It appears that the serialVersionUID variable is not getting properly set for the TradeOrder class or one of the classes that it relies upon.

Ensure all classes include:
private static final long serialVersionUID = 1L;

com.sumzerotrading.data.SumZeroException: java.io.InvalidClassException: com.sumzerotrading.broker.order.TradeOrder; local class incompatible: stream classdesc serialVersionUID = -6534894073938597060, local class serialVersionUID = 2709729678604759892

Specify the Account

Hi,
Is there a way to specify the account number before starting the trading via the API?
:)Vincent Yap

add a CFDTicker class and member variable defaultProperty in Ticker

1 add cfdTick : cfd is quite popular is ib today
2 add member variable defaultProperty in Ticker : will be more convenient cause some ticker type like cfd can only require bid/ask data , no trades data.

i have made this change of my local pc. Becasue Ticker and ShowProperty are in different package , add dependency of differnt package will make it ugly so i didn't make a pull request. Hope you can tweak it nicely.

And thanks for your great work .

Implement market data snapshot

Ability to get a market data snapshot as described on p. 47 of the "Getting Started with the TWS Java API" guide.

Perhaps adding additional Map of Level1qoute and listeners to QuoteEngine to handle market data snapshots (MDS) to keep MDS listeners separate from subscriptions, so that when tickSnapshotEnd() is called an MDS listener is removed but subscription one is kept.

Interactive Brokers HMDS query returned no data

Properly handle error message from IB:
Quote engine error: id='43' errorCode='162' message='Historical Market Data Service error message:HMDS query returned no data: GOOGL@SMART Trades'

Currently the call to request the historical data will continue to block as it doesn't recognize this is an error condition. The call should throw an exception back to the caller, and the caller can decide if they want to query for the historical data again.

Level1QuoteListener stop after placing the order

Hi,
I have tried to modify the TradingExampleWithOrderStatusListener.java by adding the Level1QuoteListener. After running it, the quotes can be received until placing the order. Although I have added the sleep code, the quote listener will stop after placing the order.
Attached the modified code and also the log file for your investigation.
Give me some hints on how to continue receiving the quotes after placing the order.
Thank you.

Best Regards,
Vincent Yap
TradingExampleWithOrderStatusListener_java.txt
tradingexamplelog.txt

Build fails

Running mvn clean install leads to the error:

[ERROR] Failed to execute goal on project collective2-broker-api-impl: Could not resolve dependencies for project com.sumzerotrading:collective2-broker-api-impl:jar:1.0.0-SNAPSHOT: Could not find artifact com.sumzerotrading:J4C2:jar:1.0.0-SNAPSHOT -> [Help 1]

Contract Description is ambiguous error from IB

The follow error is being throw back from IB when attempting to subscribe to market data for GLD and GDX.

2016-04-07 09:55:46 ERROR InteractiveBrokersBroker:263 - BrokerError: ID:100003 errorCode:200 errorMessage: The contract description specified for GDX is ambiguous.
2016-04-07 09:55:46 ERROR InteractiveBrokersBroker:263 - BrokerError: ID:100004 errorCode:200 errorMessage: The contract description specified for GLD is ambiguous.

Fluent API for ticker symbols

Create a fluent API for ticker symbols so that they can be configured with less code.

ie

FuturesTicker ticker = new FuturesTicker("CL").setExpiryMonth(3).setExpiryYear(12).setCurrency("USD")

how to get open positions

i'm trying to get open positions from ib with getOpenPositions but find out that it only returns an empty array from InteractiveBrokersBroker.getAllPositions() .  
Then in EClientSocket.reqPositions() method , it just do nothing but print some version numbers. I'm a liitle confused how to do it .

IB Connection status

There are no status return for InteractiveBrokersClientInterface.connect() method. I have noticed that sometime it will fail to connect the IB. In this case, it is good to have this connect() method to return the status.

Store QuoteEngine listeners in a Set instead of a List

com.sumzerotrading.marketdata.QuoteEngine stores listeners in Lists. When subscribing to Level1 and Level2 quotes and reusing the same listener, it could be added more than once to the List, and would receive the same quote multiple times.

Using a Set would solve this problem.

IB Order Events are modifying Ticker objects

It appears IB Order Events are modifying ticker objects which is causing anything that uses ticker.equals() to return false after an order event is fired, when before the order event the equals() method would have returned true.

NullPointerException thrown by InteractiveBrokersBroker on startup.

java.lang.NullPointerException
at com.sumzerotrading.broker.ib.InteractiveBrokersBroker.getDirName(InteractiveBrokersBroker.java:444)
at com.sumzerotrading.broker.ib.InteractiveBrokersBroker.createDir(InteractiveBrokersBroker.java:437)
at com.sumzerotrading.broker.ib.InteractiveBrokersBroker.loadOrderMaps(InteractiveBrokersBroker.java:425)
at com.sumzerotrading.broker.ib.InteractiveBrokersBroker.(InteractiveBrokersBroker.java:117)
at com.sumzerotrading.interactive.brokers.client.InteractiveBrokersClient.(InteractiveBrokersClient.java:80)
at com.sumzerotrading.interactive.brokers.client.InteractiveBrokersClient.getInstance(InteractiveBrokersClient.java:65)
at com.sumzerotrading.ib.example.trading.TradingExampleWithOrderStatusListener.placeFuturesOrder(TradingExampleWithOrderStatusListener.java:51)
at com.sumzerotrading.ib.example.trading.TradingExampleWithOrderStatusListener.main(TradingExampleWithOrderStatusListener.java:115)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.