Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions samples/ConsoleSample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
10 changes: 1 addition & 9 deletions samples/ConsoleSample/main.py
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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,
Expand Down