GithubHelp home page GithubHelp logo

elixir-order-matching's Introduction

OrderMatchingEngine

Matching engine is the engine support set of limit order commands from input.json The commands will be triggered in order from first (top) to last(bottom) of the list.

Input Examples:

{
  "orders": [
    {"command": "sell", "price": 100.003, "amount": 2.4},
    {"command": "buy", "price": 90.394, "amount": 3.445}
  ]
}

Output of the matching engine is Order Book in output.json. The output has 2 attributes which are buy, sell attributes.

Buy section has Buy price, Buy volume.

  • Buy prices are ordered from high to low
  • Buy volume is accumulated of buy amount which lies in the same price.

Sell section: Sell section has Sell price, Sell volume

  • Sell prices are ordered from low to high
  • Sell volume is accumulated of sell amount which lies in the same price.

Output Examples:

{
  "sell": [
    {
      "volume": 2.4,
      "price": 100.003
    }
  ],
  "buy": [
    {
      "volume": 3.445,
      "price": 90.394
    }
  ]
}

Prerequisite

  • Elixir, you can look for installation of Elixir in this website.

## Setup ```shell mix deps.get ``` --- ## Testing ```shell mix test test/* ``` --- ## Command

To take input file(input.json) and build the book orders output file (output.json).

# build output.json file from input.json file
mix run -e "OrderMatchingEngine.build_order_book_from_order_request_file('input.json') |> OrderBookRepository.save"

Module Docs

You can generate docs via this command:

mix docs

TODO: task list

  • ✅ Read Json File
  • ✅ Build Model
  • ✅ Parse Json to Model
  • ✅ Build Buy Sell Section
  • ✅ Write Section to Json File
  • ✅ Matching Engine (Time Priority)
  • ✅ Order Book (list of orders, A matching engine uses the book to determine which orders can be fulfilled i.e. what trades can be made.)
  • ✅ Refactor Code
  • ✅ Finishing Docs
  • ✅ Read me

elixir-order-matching's People

Contributors

montionugera avatar

Watchers

 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.