Giter Club home page Giter Club logo

igzplugin's Introduction

My Notes

DLL Exports igzorrobridge.cpp (mostly via DllCallHandler.cpp)

  • BrokerOpen(char *Name, FARPROC fpError, FARPROC fpProgress)
  • BrokerLogin(const char *User, const char *Pwd, const char *Type, char *Accounts)
  • BrokerTime(DATE *pTimeUTC)
  • BrokerAccount(const char *Account, double *pBalance, double *pTradeVal, double *pMarginVal)
  • BrokerAsset(char* Asset, double *pPrice, double *pSpread, double *pVolume, double *pPip, double *pPipCost, double *pLotAmount, double *pMarginCost, double *pRollLong, double *pRollShort)
  • BrokerHistory2(const char *Asset, const DATE tStart, const DATE tEnd, const int nTickMinutes, const int nTicks, T6 *ticks)
  • BrokerBuy(const char *Asset, int nAmount, double dStopDist, double *pPrice)
  • BrokerSell(const int nTradeID, const int nAmount)
  • BrokerStop(const int nTradeID, const double dStop)
  • BrokerTrade(const int nTradeID, double *pOpen, double *pClose, double *pRoll, double *pProfit)
  • BrokerHTTP(FARPROC fpSend, FARPROC fpStatus, FARPROC fpResult, FARPROC fpFree)
  • BrokerCommand(int nCommand, DWORD dwParameter)

DllCallHandler.cpp (not exposed via DLL)

  • BrokerLogout()
  • SubscribeAsset(const char* Asset)
  • SetOrderText(const char *orderText)

IG Zorro Plugin

This a plugin for Zorro which lets you trade with IG. It implements the Zorro-Broker-API.

It borrows heavily from the Dukascopy plugin for Zorro, especially the c++ bridge. Thanks to juxeii for open sourcing his code

General installation

1.) Download and install the latest 32-bit Java JDK. Make sure it is the 32-bit version(x86 suffix) since the plugin DLL is a 32-bit library. In case you already have a 32-bit JDK installation(check it with java -version) you might skip this step.

2.) Add ${yourJDKinstallPath}\jre\bin and ${yourJDKinstallPath}\jre\bin\client to the front of your Path environment variable(here is a howto).

3.) Install Zorro if not already on your machine.

In most cases, following steps 1-3 should be enough as the IG plugin is now distributed with Zorro. If there is a new version of the plugin that you want to run, that has not yet been distributed by Zorro, follow steps 4-5 below:

4.) Download the igplugin.zip archive.

5.) Extract the archive into ${yourZorroInstallPath\Plugin} folder.

Configuration/Usage

API Keys

After extracting the igplugin archive you should see a ig.dll and a folder ig in the Plugin directory of your Zorro installation.

If you have not done so already, you now need to generate an API key to be able to use the IG API through Zorro. Refer to IG Labs Getting Started guide for step by step instructions on how to do this.

Go to the ig folder and open the application.properties file with a text editor.

Here you should adapt the plugin.realApiKey and/or plugin.demoApiKey to your match the values of the keys that you generated in the previos step. You can leave the other entries to their default values.

Assets

Before you start Zorro you must also update the AssetsFix.csv with correct symbol names for the assets you want to trade. Refer to The asset list section of the Zorro manual for details on this. The asset names the IG API expects is very different from the ones that Zorro uses by default. For instance the EUR/USD name is CS.D.EURUSD.CFD.IP You can find the correct symbol names for you favorite assets by using the IG API Companion Log in with you user name, password and api key, then scroll down to Market Search, enter your search String, e.g. DAX. Now look in the response for the "epic" key, e.g "epic": "IX.D.DAX.IFD.IP",

Start Zorro and look in the Account drop-down-box. You should see IG as an available broker. Enter your login details, pick a script of your choice and press Trade. If everything is fine you should see that the login to IG has been successful.

Logs

The plugin stores its logs to ig/logs/igzplugin.log(the default log level is info). If you encounter problems open ig/igzplugin/logback.xml for configuring the log level. Then change the log level for the file igzplugin-appender to debug and save the file. A new Zorro session will now produce a more verbose igzplugin.log file which you can use to report errors.

Please use pastebin for uploading the logs.

Order reference text

Since version 0.3, the plugin supports the brokerCommand setOrderText. Call it like this in your script

brokerCommand(SET_ORDERTEXT,"MyOwnTest");

This enables you to set your own references on orders and makes it easier to separating PnL for different strategies in hindsight. The text can be no more than 19 characters long, and must only contain A-Z, a-z, 0-9, _ and -

Remarks

  • You WILL need to update the AssetsFix with Symbol names. For instance the EUR/USD name is CS.D.EURUSD.CFD.IP
  • The default allowance for IG historic prices is 10 000 quotes per week. If your allowance goes to zero, you won't even be able to download quotes for the lookback period. This means it is not a good idea to use IG as a source for downloading long periods of historic data.
  • Keep your historic data as up to date as possible and prefer using the PRELOAD-flag in you scripts. Even just filling the lookback will get rate limited if you have many assets and are too far behind on historic data.
  • The default quotas for IG Streaming API connections is 40 concurrent connections. The plugin currently uses 2 streams per asset, which means so can at a maximum trade 20 assets at the same time. Contact IG if you need to raise your limit.

Feedback

  • Feel free to suggest improvements, post issues or suggest pull requests here on Github
  • Follow discussions for this project on the Zorro forum
  • Find me on Twitter, @SweetSpotDan

igzplugin's People

Contributors

juxeii avatar xbotuk avatar

Watchers

 avatar

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.