All Projects → abhi-g80 → pytradesimulator

abhi-g80 / pytradesimulator

Licence: MIT license
Python based exchange simulator using FIX protocol

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pytradesimulator

redis-matching-engine-server
Implement exchange matching engine by lua script, run in redis
Stars: ✭ 39 (+95%)
Mutual labels:  matching-engine, exchange-server
fixparser
FIX5.0SP2 parser.
Stars: ✭ 50 (+150%)
Mutual labels:  fix-protocol, fix-engine
dingir-exchange
A high performance crypto trading engine
Stars: ✭ 169 (+745%)
Mutual labels:  matching-engine, exchange-server
CVE-2021-33766
ProxyToken (CVE-2021-33766) : An Authentication Bypass in Microsoft Exchange Server POC exploit
Stars: ✭ 37 (+85%)
Mutual labels:  exchange-server
FullFIX
A library for parsing FIX (Financial Information eXchange) protocol messages.
Stars: ✭ 60 (+200%)
Mutual labels:  fix-protocol
quantlib
The idiomatic rust implementation of the QuantLib C++ quantitative finance library
Stars: ✭ 89 (+345%)
Mutual labels:  hft-trading
xExchange
This module contains DSC resources for deployment and configuration of Microsoft Exchange Server.
Stars: ✭ 62 (+210%)
Mutual labels:  exchange-server
neural-finance
Neural Network for HFT-trading [experimental]
Stars: ✭ 67 (+235%)
Mutual labels:  hft-trading
gome
gome- Golang Match Engine, uses Golang for calculations, gRPC for services, ProtoBuf for data exchange, RabbitMQ for queues, and Redis for cache implementation of high-performance matching engine microservices/ gome-高性能撮合引擎微服务
Stars: ✭ 47 (+135%)
Mutual labels:  matching-engine
roq-samples
How to use the Roq C++20 API for Live Cryptocurrency Algorithmic and High-Frequency Trading as well as for Back-Testing and Historical Simulation
Stars: ✭ 119 (+495%)
Mutual labels:  matching-engine
tumbleweed gdax
Prototype market maker specialized to trade on CoinbasePro
Stars: ✭ 41 (+105%)
Mutual labels:  hft-trading
matching-engine
Superfast Matching Engine written in golang
Stars: ✭ 35 (+75%)
Mutual labels:  matching-engine
crypto-database
Database for crypto data, supporting several exchanges. Can be used for TA, bots, backtest, realtime trading, etc.
Stars: ✭ 72 (+260%)
Mutual labels:  hft-trading
Purge-LogFiles
PowerShell script for Exchange Server 2013+ environments to clean up Exchange and IIS log files.
Stars: ✭ 22 (+10%)
Mutual labels:  exchange-server
Tribeca
A high frequency, market making cryptocurrency trading platform in node.js
Stars: ✭ 3,646 (+18130%)
Mutual labels:  hft-trading
Remove-DuplicateItems
Script to remove duplicate items from Exchange mailboxes.
Stars: ✭ 32 (+60%)
Mutual labels:  exchange-server
clob
Simple limit order book and matching engine.
Stars: ✭ 17 (-15%)
Mutual labels:  matching-engine
ExchangeAnalyzer
Exchange Analyzer - Checks Exchange Server 2013 or 2016 organizations for common configuration issues and recommended practices.
Stars: ✭ 100 (+400%)
Mutual labels:  exchange-server
Stocksharp
Algorithmic trading and quantitative trading open source platform to develop trading robots (stock markets, forex, crypto, bitcoins, and options).
Stars: ✭ 4,601 (+22905%)
Mutual labels:  hft-trading
quanttrade
Quantitative Trading Library
Stars: ✭ 16 (-20%)
Mutual labels:  hft-trading

Python exchange simulator

A python based trading exchange running on FIX.4.2.

The exchange performs order matching based on FIFO order matching algorithm. Amending existing order is also supported via FIX OrderCancelReplaceRequest message.

Order types

Limit
Market

Run

Running ordering client and exchange server.

Clone the repo and run the following commands,

$ cd pytradesim
$ mkdir logs
$ ./server.py
$ ./client.py configs/client1.cfg

Running market data client and market data adapter.

$ ./market_client.py configs/mdclient1.cfg
$ ./market_data.py

Example

Start market data client.

$ ./market_data.py
2020-05-23 18:31:52.701728 [INFO   ] (main     ) Logging set to info.
2020-05-23 18:31:52.711440 [INFO   ] (onCreate ) Successfully created sessions FIX.4.2:MARKET->MDCLIENT1.
2020-05-23 18:31:52.716357 [INFO   ] (onCreate ) Successfully created sessions FIX.4.2:MARKET->MDCLIENT2.
2020-05-23 18:31:52.717506 [INFO   ] (main     ) FIX.4.2 maarket data server started.
2020-05-23 18:32:12.909809 [INFO   ] (onLogon  ) FIX.4.2:MARKET->MDCLIENT1 successfully logged in.
2020-05-23 18:32:34.697594 [INFO   ] (onLogon  ) FIX.4.2:MARKET->MDCLIENT2 successfully logged in.

Start the market data clients and subscribe to instruments (example, MSFT, HYG).

$ ./market_client.py configs/mdclient1.cfg -d
2020-05-23 18:32:12.901025 [INFO   ] (main     ) Logging set to debug.
2020-05-23 18:32:12.907327 [INFO   ] (onCreate ) Successfully created session FIX.4.2:MDCLIENT1->MARKET.
2020-05-23 18:32:12.909923 [INFO   ] (onLogon  ) FIX.4.2:MDCLIENT1->MARKET session successfully logged in.
Enter symbol to subscribe: MSFT
2020-05-23 18:32:38.002055 [DEBUG  ] (toApp    ) Sending 8=FIX.4.29=12935=V34=249=MDCLIENT152=20200523-16:32:38.00000056=MARKET146=155=MSFT262=TESTREQUEST1263=1264=10267=3269=0269=1269=210=218 session FIX.4.2:MDCLIENT1->MARKET

Start the exchange server.

$ ./server.py
2020-05-23 18:31:57.270028 [INFO   ] (main     ) Logging set to info.
2020-05-23 18:31:57.276828 [INFO   ] (onCreate ) Successfully created session FIX.4.2:EXCHANGE->CLIENT1.
2020-05-23 18:31:57.280955 [INFO   ] (onCreate ) Successfully created session FIX.4.2:EXCHANGE->CLIENT2.
2020-05-23 18:31:57.281989 [INFO   ] (main     ) FIX.4.2 server started.
2020-05-23 18:31:57.284128 [INFO   ] (main     ) Started market data publisher at port 9000.

Start the trading clients.

$ ./client.py configs/client1.cfg
2020-05-23 18:32:48.812824 [INFO   ] (main     ) Logging set to info.
2020-05-23 18:32:48.820117 [INFO   ] (onCreate ) Successfully created session FIX.4.2:CLIENT1->EXCHANGE.
2020-05-23 18:32:48.821577 [INFO   ] (onLogon  ) FIX.4.2:CLIENT1->EXCHANGE session successfully logged in.
Enter choice :-
1. New order
2. Replace order
3. Delete order
>

To send a order in MSFT, select new order and then set the required prices.

Enter order :-
Symbol: MSFT
Price: 189
Quantity: 675
Side: buy
Type: limit
Sending new order...
2020-05-23 18:33:27.082369 [INFO   ] (fromApp  ) Got message 8=FIX.4.29=18035=834=349=EXCHANGE52=20200523-16:33:27.00000056=CLIENT16=18911=CLIENT1MSFT114=67517=MSFT_E_00000120=031=18932=67537=MSFT_O_00000138=67539=054=155=MSFT150=0151=010=111 for FIX.4.2:CLIENT1->EXCHANGE.
2020-05-23 18:33:27.082713 [INFO   ] (process  ) Order placed successfully.
2020-05-23 18:33:27.082950 [INFO   ] (process  ) Order: 17=MSFT_E_000001, 11=CLIENT1MSFT1 55=MSFT 32=675@31=189 54=1

Price published to market data client.

2020-05-23 18:33:27.560618 [INFO   ] (fromApp  ) Got message 8=FIX.4.29=9735=W34=449=MARKET52=20200523-16:33:27.00000056=MDCLIENT155=MSFT268=1269=0270=189271=67510=192 for FIX.4.2:MDCLIENT1->MARKET.
8=FIX.4.2|9=97|35=W|34=4|49=MARKET|52=20200523-16:33:27.000000|56=MDCLIENT1|55=MSFT|268=1|269=0|270=189|271=675|10=192|
Symbol: MSFT
+------------------+--------------------+
| bid_prc, bid_qty |  ask_prc, ask_qty  |
+------------------+--------------------+
|  (189.0, 675.0)  | ('Empty', 'Empty') |
+------------------+--------------------+

Trades done will be published to the clients and to the market data subscribers.

Test

All tests should pass.

$ py.test tests -v
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].