Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Back-Testing IB-API Strategies

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Back-Testing IB-API Strategies

    Hello there,


    Can NinjaTrader be used for testing automated trading strategies implemented over Interactive Brokers API?

    If so, could you please give starting guidelines or send a link to good documentation?


    Thanks much,
    Bliss
    Last edited by Bliss; 02-26-2013, 07:31 AM. Reason: Typo Fix

    #2
    Hello Bliss,

    Welcome to the NinjaTrader Support Forums!

    All what is needed to run a Backtest inside of NinjaTrader is Historical data and an Automated Strategy. You may download Historical data from Interactive Brokers (IB) via their API by setting up the connection to IB from NinjaTrader with the step in the following link.


    Here is a link to our Help Guide that goes over all of the Historical Data that each of our Supported Data Providers that you may view.


    Once, you have access to the Historical Data then you may use the Strategy Analyzer to Backtest your NinjaScript Strategy.



    Let us know if we can be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Strategies coded using IB-API

      Thanks JC for your response.

      I'm actually interested in back-testing strategies coded using Interactive-Brokers API and would not want to re-code my strategies using Ninja Script.

      Is this possible?
      Last edited by Bliss; 02-26-2013, 08:34 AM. Reason: clarification

      Comment


        #4
        Hello Bliss,

        This would not be possible as backtesting will only work on NinjaScript Strategies.
        JCNinjaTrader Customer Service

        Comment


          #5
          IB API Using Python Convert them to REST Full web service

          I am looking for someone to help me out in implementing IB APIs Using python in my mobile application. I want to convert that functions into REST API call so i can call that function from my php or node web-server.I am attaching code here,if anyone can help it will be great.

          Thanks,

          Code:

          from ibapi.client import EClient
          from ibapi.wrapper import EWrapper
          from ibapi.account_summary_tags import *
          from ibapi.comm import *
          from ContractSamples import *
          from OrderSamples import *
          from ibapi.order import *
          from ibapi.order_state import *
          from ibapi.order_condition import *
          from ibapi.common import *
          from ibapi.contract import *
          from pickle import FALSE
          from _overlapped import NULL
          from flask import Flask, request
          from flask_restful import Resource, Api
          from sqlalchemy import create_engine
          from json import dumps
          from flask_jsonpify import *
          from werkzeug.wsgi import responder
          from time import sleep
          from test.test_concurrent_futures import sleep_and_print

          app = Flask(__name__)
          api = Api(app)

          class Connect(EWrapper,EClient,Resource):
          def __init__(self):
          EClient.__init__(self,self)

          def get(self):
          self.connect("127.0.0.1", 7497, clientId = 0)
          return ('Connected')
          class AccountSummary(Connect,Resource):
          def __init__(self):
          EClient.__init__(self,self)

          def accountSummary(self, reqId: int, account: str, tag: str, value:
          str,currency: str):
          super().accountSummary(reqId, account, tag, value, currency)
          return ("AcctSummary. ReqId:", reqId, "AcctNo:", account,"Tag: ", tag, "Value:", value, "Currency:", currency)

          def get(self):
          self.connect("127.0.0.1", 7497, clientId = 0)
          self.reqAccountSummary(9090, "All", AccountSummaryTags.AllTags)

          class PlaceOrder(Connect,Resource):
          def __init__(self):
          EClient.__init__(self,self)

          def orderStatus(self, orderId:OrderId, status:str, filled:float,
          remaining:float, avgFillPrice:float, permId:int,
          parentId:int, lastFillPrice:float, clientId:int,
          whyHeld:str):
          print ("status")
          self.disconnect()

          def get(self):
          self.connect("127.0.0.1", 7497, clientId = 0)
          sampleOrderId = 1234
          self.placeOrder(sampleOrderId, ContractSamples.USStock(),
          OrderSamples.Mar****rder("BUY", 1))
          api.add_resource(Connect, '/connect') # Route_1
          api.add_resource(AccountSummary, '/summary') # Route_2
          api.add_resource(PlaceOrder, '/placeorder') # Route_2rder
          if __name__ == '__main__':
          app.run(port='5002')

          Comment


            #6
            Hello viru1992,

            Thank you for your post and welcome to the NinjaTrader Support Forum!

            NinjaTrader platform support would not be able to assist in custom API development or development outside of NinjaScript in general. You may benefit from creating a new thread with a specific title for your request so that other forum members can see your post more clearly.

            Please let me know if you have any questions.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by geddyisodin, Today, 05:20 AM
            6 responses
            34 views
            0 likes
            Last Post geddyisodin  
            Started by trilliantrader, Today, 03:01 PM
            0 responses
            3 views
            0 likes
            Last Post trilliantrader  
            Started by pechtri, 06-22-2023, 02:31 AM
            9 responses
            122 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by frankthearm, 04-18-2024, 09:08 AM
            16 responses
            67 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by habeebft, Today, 01:18 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X