Home Interactive Brokers LLC

Run Another Service Within Flask

Hello, I am having a problem with flask and quickfix. For those who don't know, quickfix is a python framework for creating FIX engines (FIX is a messaging protocol for financial services). My project started with a command line interface where I would start my quickfix app and keep a while loop asking for user input.
Now I must modify my project as a web app and decided to use flask. I set up a flask route to start the quickfix server but every time I access that API endpoint from Postman, my flask server dies, sometimes with a buffer overflow error and sometimes it does not give me any error messages.
Here is my flask code (it is very basic). The route that is causing the problem now is "/api/start_fix/" at flask_api.py:
from flask import Flask, render_template import fixapp from types import SimpleNamespace app = Flask(__name__) fix_handle = None @app.route('/') def home(): return "

This is a sample

" @app.route('/api/start_fix/',methods=['POST']) def start_fix(config_file): #these three lines below are temporary and circling each other. args = vars(fixapp.get_default_args()) args['config'] = config_file args['verbose'] = 3 args = SimpleNamespace(**args) fix_handle = fixapp.create_fix_app(args,fix_mode='manual') fix_handle.start() return "SUCCESS" @app.route('/api/start_quote/',methods=["POST"]) def start_quote(symbol): options = {'55':symbol} fix_handle.send_subscribe_to_data(options) @app.route('/api/get_ticks',methods=['GET']) def get_ticks(): return fix_handle.get_ticks() #get_ticks should return a json object @app.route('/api/get_ticks/',methods=['GET']) def get_ticks_by_size(size): return fix_handle.get_ticks(size=size) #should be json if __name__ == '__main__': app.run(debug=True)
fixapp is my implementation with quickfix and structured as a python package. I was hoping to use fix_handle to access data from within it through flask but the server crashes right at the beginning.
I will include a snippet of the function fix_handle.start() in case it is useful even though it is very short fixapp/session_object.py:
class SessionBase(object): """Base session object. It will be used to initialized most of the session object parameters""" def __init__(self,args): self.args = args self.config_file = args.config self.settings = fix.SessionSettings(self.config_file) self.decoder = FixDecoder() self.datastream = DataStream() self.orderstore = OrderStore() self.storeFactory = fix.FileStoreFactory(self.settings) self.logFactory = fix.FileLogFactory(self.settings) def start(self): """Initiate FIX app and do nothing else. This will only work if the child class has implemented the self.app and self.initiator""" try: self.initiator.start() time.sleep(1) print("FIX application has started...") #fixapp.utils.fix_started_msg() except (fix.ConfigError , fix.RuntimeError) as e: print(e) . . . 

self.initiator.start() is a function from the quickfix library and not implemented by me.
Also, to make it more clear, I want to remind that fixapp will start a process on its own and a server connection to a forex broker. This functionality used to work well from the command line but from within flask it can't work.
I looked into using threading or multi-threading libraries and was thinking of starting a new thread for each time my flask endpoint is sent a request, but it is still unclear to me how I could communicate with my quickfix process. Quickfix needs to be running in the background and those flask endpoints simply redirect to it. Quickfix will be continuously collecting FOREX data from the market.
I guess this is more about how to approach my problem by running quickfix from inside flask so that users of the web app can interact with it.
I would appreciate if someone can help me with this issue and if I wasn't clear or there is more information needed, please let me know.
submitted by esidehustle to flask [link] [comments]

b

If you guys could post other things that you've found useful too, that'd be great.
submitted by confluencefx to u/confluencefx [link] [comments]

The REAL reason I’ll NEVER use Interactive Brokers again ... Interactive Brokers - YouTube How to convert Forex and currency exchange with ... Interactive Brokers Platform Tutorial for Day Trading 2020 ... How I Trade Forex with InteractiveBrokers - YouTube How to Use Interactive Brokers Platform to Place a Trade ...

Interactive Brokers forex offering is the only true ECN broker with direct access to interbank quotes. This means: No markup; No hidden price spreading; Direct access to liquidity providing banks or other IBKR clients ; While the online broker doesn’t publish their average spreads (for comparison to other brokers) you can see their real-time quotes on their website that are set by the market ... Interactive Brokers introduces Direct Access Bond Trading, Institutional FOREX, Singapore Futures, German Warrants, French and Dutch stocks and options, CBOE Futures and trading on the Frankfurt/Stuttgart exchanges. Our Intermarket Spread Router searches across all exchanges for the best price on each individual leg of a spread order. We upgraded our account management platform to include a ... Interactive Brokers Group, Inc. was founded by its Chairman and CEO Thomas Peterffy. Over the last 36 years, it has grown internally to become one of the premier securities firms with over $4.8 billion in equity capital. Interactive Brokers conducts its broker/dealer and proprietary trading businesses on over 100 market destinations worldwide ... Interactive Brokers Takes Top Spot in Barron's Best Online Brokers 2020 . Interactive Brokers ranked #1 Best Online Broker in Barron's 25th annual ranking of The Best Online Brokers. Learn more about all our recent awards. Read More. A Broker You Can Trust. When placing your money with a broker, you need to make sure your broker is secure and can endure through good and bad times. Our strong ... Interactive Brokers Canada Inc. is an execution-only dealer and does not provide investment advice or recommendations regarding the purchase or sale of any securities or derivatives. Registered Office: 1800 McGill College Avenue, Suite 2106, Montreal, Quebec, H3A 3J6, Canada. Website: www.interactivebrokers.ca. Interactive Brokers U.K. Limited Interactive Brokers Group, Inc. was established by its Chairman and CEO Thomas Peterffy. In the course of the most recent 36 years, it has developed inside to get one of the chief protections firms with over $4.8 billion in value capital. Intelligent Brokers directs its agent/seller and restrictive exchanging organizations on more than 100 market […] Interactive Brokers Canada Inc. is an execution-only dealer and does not provide investment advice or recommendations regarding the purchase or sale of any securities or derivatives. Registered Office: 1800 McGill College Avenue, Suite 2106, Montreal, Quebec, H3A 3J6, Canada. Website: www.interactivebrokers.ca. Interactive Brokers U.K. Limited

[index] [59] [14038] [9715] [7137] [15389] [15644] [29226] [6378] [4549] [4053]

The REAL reason I’ll NEVER use Interactive Brokers again ...

We show you in this short video how to make a currency change with the Trader Workstation. Using the search function and the order window, you can efficientl... How to use Interactive Brokers platform video where we show you how to place a trade in Interactive Brokers tws. 🎈 Start your 14-day free trial with our trad... Interactive Brokers LLC is a member of NYSE, FINRA, SIPC. Interactive Brokers provides electronic access to over 135 market destinations globally with a wide... Earn highest cashback forex rebate from top forex brokers around the world with IntraQuotes. No 1 forex rebate site with lots of regulated ECN brokers, STP forex brokers. Earn FX rebate for each ... Curious about my trades If you have questions 🤷‍♂️👨‍💻😉 ask them below! I respond to every question posted on my channel. You're 7 Steps away from Becomin... See how easy it is to enter Forex orders and trade with IB. I use the regular TWS/trading workstation just like I do for my stock and ETF trades. This step b... 🇺🇸Open an account with IB: https://bit.ly/3hqecOG 🇨🇦Interactive Brokers Canada: https://bit.ly/2FBwdMo Get my FREE Trading Journal&Watchlist: https://bit.ly/...

http://arab-binary-option.enobasropo.cf