virendra@groups.io

Group Description

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.MarketOrder("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')

Group Information

  • 1 Member
  • 0 Topics
  • Started on
  • Feed

Group Settings

  • All subscribers can post to the group.
  • Posts to this group do not require approval from the moderators.
  • Posts from new users require approval from the moderators.
  • Messages are set to reply to group.
  • Subscriptions to this group do not require approval from the moderators.
  • Archives are visible to anyone.
  • Wiki is visible to subscribers only.
  • Members can edit their posts.
  • Members can set their subscriptions to no email.

Integrations

No integrations.

Top Hashtags [See All]

 or  Log In If You Are Already A Member

Message History

Group Email Addresses