ctrader-fix-0.1.1
توضیحات
A Python package for interacting with cTrader FIX API
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | ctrader-fix-0.1.1 |
| نام | ctrader-fix |
| نسخه کتابخانه | 0.1.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Spotware |
| ایمیل نویسنده | connect@spotware.com |
| آدرس صفحه اصلی | https://github.com/spotware/cTraderFixPy |
| آدرس اینترنتی | https://pypi.org/project/ctrader-fix/ |
| مجوز | MIT |
# cTraderFixPy
[](https://badge.fury.io/py/ctrader-fix)

[](https://github.com/spotware/cTraderFixPy/blob/main/LICENSE)
A Python package for interacting with cTrader FIX API.
This package uses Twisted and it works asynchronously.
- Free software: MIT
- Documentation: https://spotware.github.io/cTraderFixPy/.
## Features
* Works asynchronously by using Twisted
* Allows you to easily interact with cTrader FIX API and it manages everything in background
* Generate FIX message by using Python objects
## Insallation
```
pip install ctrader-fix
```
# Config
Config file sample:
```json
{
"Host": "",
"Port": 0,
"SSL": false,
"Username": "",
"Password": "",
"BeginString": "FIX.4.4",
"SenderCompID": "",
"SenderSubID": "QUOTE",
"TargetCompID": "cServer",
"TargetSubID": "QUOTE",
"HeartBeat": "30"
}
```
# Usage
```python
from twisted.internet import reactor
import json
from ctrader_fix import *
# Callback for receiving all messages
def onMessageReceived(client, responseMessage):
print("Received: ", responseMessage.getMessage().replace("", "|"))
messageType = responseMessage.getFieldValue(35)
if messageType == "A":
print("We are logged in")
# Callback for client disconnection
def disconnected(client, reason):
print("Disconnected, reason: ", reason)
# Callback for client connection
def connected(client):
print("Connected")
logonRequest = LogonRequest(config)
send(logonRequest)
# you can use two separate config files for QUOTE and TRADE
with open("config-trade.json") as configFile:
config = json.load(configFile)
client = Client(config["Host"], config["Port"], ssl = config["SSL"])
# Setting client callbacks
client.setConnectedCallback(connected)
client.setDisconnectedCallback(disconnected)
client.setMessageReceivedCallback(onMessageReceived)
# Starting the client service
client.startService()
reactor.run()
```
Please check documentation or samples for a complete example.
## Dependencies
* <a href="https://pypi.org/project/twisted/">Twisted</a>
نیازمندی
| مقدار | نام |
|---|---|
| ==21.7.0 | Twisted |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8,<4.0 | Python |
نحوه نصب
نصب پکیج whl ctrader-fix-0.1.1:
pip install ctrader-fix-0.1.1.whl
نصب پکیج tar.gz ctrader-fix-0.1.1:
pip install ctrader-fix-0.1.1.tar.gz