Giter Club home page Giter Club logo

noobit-markets's Introduction

Build Status Codacy Badge

noobit-markets

Overview

Building Blocks for connecting and trading with cryptocurrency exchanges under a unified format.
Primarily meant to be integrated within larger applications, but also provides a basic CLI app.
Presently supported exchanges:

  • Kraken
  • Binance
  • Ftx

For now we restrict instruments to spot pairs.


Features

  • Unified API, independent of exchange
  • Fully typed with annotations and checked with mypy
  • Fully modeled domains relying on Pydantic models (for validation and serialization)
  • Safe and explicit function returns thanks to a railway oriented approach and Result containers
  • CLI app that bundles all lower level coroutines and websocket streams in a user friendly manner

Models & Pydantic:

  • We rely heavily on Pydantic to check the user input and what he receives, against what we expected
    (that is, the models we have defined and should represent our domains)
  • It is important to know that pydantic not only handles validation, but also serialization.
  • As such, it will serialize data to the declared type of the field before validation, if possible
    (e.g if the field “price” is declared as a Decimal, passing a float will not throw any ValidationError as a float can be cast to a Decimal)
  • You can browse our unified models here

Containers:

  • To provide the user with more explicit returns, responses are wrapped in a Result container object, which can either be of type Ok or Err.
    The Result object's .value() method gives access to the value it holds, which will either be a response (validated against its expected model) or an exception.
  • This allows to avoid having to raise Exceptions and stopping the program from running.
  • Additionally, we provide containers which give the user richer representations of the data. For now, this is limited to tables, but can easily be extended to include pandas dataframes for ex.

Railway oriented approach:

  • This approach seeks to ensure every function or method returns a success or a failure.
    When chaining multiple functions, in case of a failure, we immediately return the failure to the user and “stop the chain”.
  • See this article for a more detailed explanation.

Usage

  • For each exchange, an interface maps keys to coroutines or websocket APIs. For an example of Krakens interface see here
  • For how to use coroutines and websocket APIs within an async app, examples with annotations and comments are available for each exchange here
  • To start the CLI app, run the noobit-cli command. As a prerequisite for subsequent CLI command, run the symbols command in the CLI on each startup.

CLI Demo

  • Launching CLI app, caching all symbols and their infos, and displaying the data as a table


  • Showing how we can set variables and get help on a command using OHLC command as an example


  • Showing how explicit returned errors are


noobit-markets's People

Contributors

maxima-us avatar maximausss avatar

Stargazers

 avatar

Watchers

 avatar  avatar

noobit-markets's Issues

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.