diff --git a/samples/ConsoleSample/README.md b/samples/ConsoleSample/README.md index 818b79d..2abc479 100644 --- a/samples/ConsoleSample/README.md +++ b/samples/ConsoleSample/README.md @@ -7,3 +7,7 @@ It uses a single thread which is the Python main execution thread for both getti Because it uses only the Python main execution thread the user input command has a time out, and if you don't enter your command on that specific time period it will block for few seconds and then it starts accepting user command again. This sample uses [inputimeout](https://pypi.org/project/inputimeout/) Python package, you have to install it before running the sample. + +Before running the sample you have to create a config file and fill it with your trading account FIX API credentials. + +Then replace the config file name on sample main file to your config file name. diff --git a/samples/ConsoleSample/main.py b/samples/ConsoleSample/main.py index a3f2766..e75e36e 100644 --- a/samples/ConsoleSample/main.py +++ b/samples/ConsoleSample/main.py @@ -1,14 +1,11 @@ #!/usr/bin/env python -import requests from twisted.internet import reactor from inputimeout import inputimeout, TimeoutOccurred -import webbrowser -import datetime import json from ctrader_fix import * -# you can have two separate config files for QUOTE and TRADE +# you can use two separate config files for QUOTE and TRADE with open("config-trade.json") as configFile: config = json.load(configFile) @@ -61,11 +58,6 @@ def send(request): diferred = client.send(request) diferred.addCallback(lambda _: print("\nSent: ", request.getMessage(client.getMessageSequenceNumber()).replace("", "|"))) -def logonRequest(**kwargs): - request = LogonRequest(config) - setParameters(request, **kwargs) - send(request) - commands = { "LogonRequest": LogonRequest, "LogoutRequest": LogoutRequest,