Giter VIP home page Giter VIP logo

pymarket's Introduction

PyMarket

PyMarket is a simple stock market engine, allowing a single stock to be traded. Only limit orders are currently supported.

Running

python -m pymarket.market

This runs the market as a server which you can connect to. In order to send buys and sells you must connect to the order queue:

import uuid
from pymarket.market import MarketManager
from pymarket.order import Buy
from pymarket.order import Sell
from pymarket.order import Order
from pymarket.order import CancelOrder

market = MarketManager(address=('localhost', 5555), authkey='pymarket')
market.connect()
order_queue = market.get_order_queue()

order_queue.put(Order(BUY, 100, 100, uuid.uuid4()))
order_queue.put(Order(SELL, 10, 100, uuid.uuid4()))
order_queue.put(Order(SELL, 10, 95, uuid.uuid4()))
order_queue.put(Order(SELL, 100, 90, uuid.uuid4()))
order = Order(BUY, 100, 80, uuid.uuid4()))
order_queue.put(order)
order_queue.put(CancelOrder(order.id))

pymarket's People

Contributors

sbuss avatar

Stargazers

Dave Herrera avatar Chrinide avatar Dāvis avatar  avatar Florian Bertholin avatar  avatar

Watchers

javagg avatar  avatar James Cloos avatar Dave Herrera avatar  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.