Code Monkey home page Code Monkey logo

pytrading-3's Introduction

PyTrading project

PyTrading is a sandbox stock market project written in Python 3.
This project has an educational purpose to learn how financial markets work.

Continuous Integration and code quality

GNU/Linux Windows Static analysis Code coverage
Build Status Build status Codacy Badge codecov

How to generate .proto files

To generate Protobuf "_pb2.py" files:

$ protoc --python_out=. *.proto`

Lexicon

  • An order is composed of a price, a quantity, a way (buy or sell) and the instrument you want to trade (e.g. Apple stock)
  • A deal is generated when there is a match between two orders on same price and same instrument (order book's last price is updated)
  • An order book hosts every incoming orders waiting to be executed (most interesting price comes first)

High level architecture

  • TradingServer is composed of two servers: a matching engine and a feeder.
    • MatchingEngine accepts orders from clients and try to match them.
    • Feeder streams continuously order books content (full snapshot).
  • TradingClient connects two client sockets: an ordersender and a feedhandler.
    • OrderSender sends order according to algorithm implemented in main_loop_hook
    • FeedHandler receives order book updates (e.g. price modified, executed order etc..)

Communication

TradingServer and TradingClient communicates via TCP/IP serialized messages.
Two serializations are available: plain text (pipe separated) and Protobuf.

Where to start

TradingSandbox module gives a good example to start in local, take a look in main_loop_hook implementation.

Requirements

  • MongoDB
  • Protobuf

pytrading-3's People

Contributors

richarddally avatar dependabot[bot] avatar

Stargazers

WebClinic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.