Code Monkey home page Code Monkey logo

grpcoin's Introduction

gRPCOIN: Programmatic paper trading platform using gRPC and Protobuf

This is an educational project that allows you to trade cryptocurrencies competitively by writing a bot on top of a gRPC-based API with real-time prices.

Using the gRPCOIN API, you can write a bot and start trading using 100,000$ cash assigned to your account when you sign up.

How to play on gRPCOIN?

Visit the https://grpco.in/ website to learn more about how to join the game.

What is on this repository?

This repository contains the server implementations and the API for the platform.

How to implement a bot?

To learn gRPC and Protocol Buffers, you should learn the API, generate the code from the proto file, and write your own bot on top.

Just to get started, you can also check out some example bot implementations:

  1. Go example bot
  2. C# example bot
  3. Node.js command-line tool
  4. Python example bot

Develop gRPCOIN API/Frontend Servers

To run the servers locally, follow these steps:

  1. Clone the repository and cd into it.

  2. Install Google Cloud SDK (gcloud tool) https://cloud.google.com/sdk/docs/quickstart

  3. Install Firestore Emulator to run database locally (this may require you to install Java Runtime Environment).

    gcloud components install cloud-firestore-emulator
  4. Make sure the emulator works by running it once:

    gcloud beta emulators firestore start
  5. From repository root, run:

    LISTEN_ADDR=localhost PORT=8080 go run ./apiserver

    to start the gRPC API server, or run

    LISTEN_ADDR=localhost PORT=8080 go run ./frontend

    to start the web frontend and navigate to http://localhost:8080 to explore.

grpcoin's People

Contributors

ahmetb avatar ahmetozer avatar emrekasg avatar theykk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

grpcoin's Issues

Add ConditionalOrders Service

Instead of buying/selling at current price, users should be able to CRUD a conditional trade order, that can also execute when they are away.

The semantics can be like following:

Service ConditionalOrders

  • CreateConditionalOrder (returns id)
  • ListConditionalOrders (that only belong to user)
  • DeleteConditionalOrder (takes id)
  • CheckOrders(only called from server)

The Condition will be the price of the crypto and the amount will be the asset you are giving(checked with a oneof field). For example:

$ ./client conditional create buy btc 37000 50k
will buy 50k worth of bitcoin when its price is equal/below 37000.
$ ./client conditional create sell btc 38000 1
will sell 1 btc when the price hits 38000. 

To prevent over-subscription, as soon as the conditional order is placed, the resources will be taken from the user's account and preserved in the new table, tied to the order. Cancelling a pending order will return the unit back to user's bank.

Every time the ticker updates the current price, it will send an rpc to CheckOrders, which will search for orders that satisfy the new price, and execute them. (If every time is too much, a different frequency can be used).

Orders will always execute with the price in their contract and not from the current price. E.g. if you give sell order at 38k, but the new price was 40k in the next ticker update, it will still sell from 38. Tough luck...

For the leaderboard, the assets that are tied to a conditional order will also be taken into account while calculating the final worth.

Since this is a learning game , a different metric can show the total asset value tied to pending conditional orders that the exchange has at any time, which will teach traders who the actual winner is :)

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.