APIBridge Download, Installation and Setup

APIBridge download – click here

APIBridge installation video – click here

APIBridge Installation video for Amazon AWS- click here

Contents

APIBridge System Requirements

  1. Amibroker (32 or 64 bit). Any version upwards from 5.50 will work. Amibroker should be connected with live data.
  2. VC++ runtime environment 2015 (32 bit). Windows-10 has this pre-installed, or you can install fresh from: https://www.microsoft.com/en-in/download/details.aspx?id=48145
  3. Broker API refer video click here
  1. Strategy in Amibroker, Python, NinjaTader etc which integrates with APIBridge. For Amibroker, you can refer https://algoji.com/amibroker-autotrade-afl-toolkit/

For Python refer: https://algoji.com/apibridge-python-sample-code/

If any of above 4 items are missing, you will not be able to start auto trading.

APIBridge Setup Instructions for Amibroker

  1. This software does not require installation! Simply download zipped folder, and extract it. Right-click on APIBridgeLauncher.exe -> Send To->Desktop (create shortcut)
  2. Login with your APIBridge ID
  3. Go to Tools->Application Settings. Under API, put your upstox api key, secret and redirect url. Important: make sure you copy-paste these settings correctly, or it will not work. Click Save after filling up this information
  4. Under Amibroker tab, give the installation path for Amibroker. Usually this is C:Program Files (x86)AmiBroker
  5. Login to APIBridge and Start Amibroker.
  6. In Amibroker, go to Tools->Preferences->Intraday. Check the option START time of interval (recommended). Click Apply.
  7. In your strategy AFL from which you want to fire signals, append the code autotrade.afl

That’s all! these are one-time settings only.

Placing Your First Order

You can place your first order in Paper Trading mode, any Broker API is not required for paper trading. You do not even need datafeed for placing an order with Paper trading. Use the Button Trading AFL and based on Amibroker chart create symbol settings.

Symbol Setting Window: This is the most important tab where you define settings for scrips in which you want to trade automatically. Here you can add symbols, one on each row, on which you want to trade. To see all features in Symbol Settings, go to Tools->Application Settings->Symbol Settings.

  1. Input Symbol is the same as you see in Amibroker or data feed
  2. Exchange Symbol is the same in which you want to trade based on buy/sell signals in Input Symbol. For example, input symbol may be “NIFTY-I” and Exchange Symbol may be “NIFTY”
  3. Other settings are self-explanatory like Quantity/OrderType/MaxLoss/MaxProfit etc. The mandatory fields are marked with *. Note that you can define quantity/ordertype from this window as well as AFL. If you want to take quantity from AFL, you should leave quantity blank in this window. Optional fields can be overwritten from AFL settings if left blank.
  4. MaxOpenPos is the maximum open position you want to take in each symbol, based on the trades for current day only.
  5. MaxProfit/MaxLoss automatically squareoff position when either limit is reached without taking StrategyTag into consideration
  6. SquareOff Time squares off all net positions for the day, cancels all pending orders and stops trading for the day.
  7. There are several other position management & risk management options which are self-explanatory

Application Settings: You can access it from Top Menu->Tools->Application Settings

  • API Settings: use as per broker given credentials
  • Signal Source: If you are using Amibroker, give it’s installation path; otherwise leave blank. Default TCP port can also be left blank.
  • Symbol Settings: If you are trading in multiple strategies, you can enter comma separated strategy tags such as STG2, STG3 etc. You can also tick which columns you want to display in Symbol Settings Window.
  • License: shows your licensing information
  • Global Risk Management: These are global settings for APIBridge and over-ride any other settings in APIBridge or your strategy code. The setting – Max Order Value Per Order – will disable Market Orders. 0 implies not limits. These are extremely helpful to manage risk even if any strategy malfunctions.

Net Positions Window

  1. APIBridge maintains a local log of all Net Positions. If it does not match from your broker API, the respective Net Position row will be shown in light red color.
  2. SyncNetPosition button syncs all net positions for current day with broker api.
  3. SquareOffAll button squares off all net positions for the day, cancels all pending orders and stops trading for the day.
  4. For trades made outside the APIBridge, you can create entries using the edit button.

APIBridge Mock Trade Settings

– Before trading live, mock trading is recommended to ensure everything is working correctly. Mock trading should be done after market hours to ensure no orders are actually placed on exchange. Example for NSE after 3:30pm – You can trade through charts or through scanner (without using charts) – Mock Trading after market hours, or during exchange mock trading session is preferable to Paper Trading mode. In Paper Trading mode, actual orders are not sent to exchange. There is semi-automatic mode also available which can be used as required. Mock Trading through charts:

  1. Setup multi-chart layout just as you would like to trade in live market. Ensure that APIBridge integrated AFL is used on each chart, and that chart parameters are correctly set.
  2. Under the settings tab in APIBridge, add scrips with correct settings for trading
  3. Click ‘Start Trading’ button in APIBridge
  4. Start bar-replay in amibroker. The step-interval should the minimum interval your data vendor allows- typically 1-minute. You can increase the Speed (steps/sec) to 5.

Mock Trading through Scanner:

  1. Setup scanner with correct settings. Refer article: https://algoji.com/auto-trading-amibroker-scanner/ . You can select date range to trigger signals on particular date.
  2. Ensure that all stocks are added under APIBridge Settings, and Start Trading

Live Trade Settings

– If there is no issue in mock trading, you can move forward to live trading. Amibroker will automatically trigger signals as per new data Trading Without Third-party Platform Trading strategies which are based directly on Price or Quantitative Analysis (and which do not require charting), can be programmed directly in APIBridge without using a third-party commercial software such as Amibroker, Excel or MT4. For such development requirement contact us https://algoji.com/trading-strategy-development/