Educational gRPC-based Bitcoin paper-trading server

Related tags

Network grpcoin
Overview

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.

Get started

  1. Create a GitHub personal access token. You don't need to give any permissions.

  2. Learn about API types and trading/portfolio endpoints in grpcoin.proto.

  3. Choose a programming language, and compile the .proto file (learn how) or you can fork an example bot implementation.

  4. Implement a bot! To authenticate to the API, you need to add an authorization header (called "metadata" in gRPC) to your requests, e.g.

    authorization: Bearer MY_TOKEN
    
  5. Endpoints you can use:

    • API PROD endpoint api.grpco.in:443 (TLS)
      • Rate limits:
        • 100 per minute for authenticated calls.
        • 50 per minute for unauthenticated calls.
    • Website: https://grpco.in/
  6. First time you make an authenticated request, your account will be created with $100,000 cash to start buying coins.

  7. Start tracking your progress on the leaderboard.

Example bot implementations

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

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

Development

To run the server 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.

You might also like...
grpc-http1: A gRPC via HTTP/1 Enabling Library for Go

grpc-http1: A gRPC via HTTP/1 Enabling Library for Go This library enables using all the functionality of a gRPC server even if it is exposed behind a

Simple grpc web and grpc transcoding with Envoy
Simple grpc web and grpc transcoding with Envoy

gRPC Web and gRPC Transcoding with Envoy This is a simple stand-alone set of con

GRPC - Creating a gRPC service from scratch

#Go gRPC services course Creating a gRPC service from scratch Command line colle

Totem - A Go library that can turn a single gRPC stream into bidirectional unary gRPC servers

Totem is a Go library that can turn a single gRPC stream into bidirectional unar

Grpc-gateway-map-null - gRPC Gateway test using nullable values in map

Demonstrate gRPC gateway behavior with nullable values in maps Using grpc-gatewa

Todo-app-grpc - Go/GRPC codebase containing RealWorld examples (CRUD, auth, advanced patterns, etc)

Go/GRPC codebase containing RealWorld examples (CRUD, auth, advanced patterns, e

Raft-grpc-demo - Some example code for how to use Hashicorp's Raft implementation with gRPC

raft-grpc-example This is some example code for how to use Hashicorp's Raft impl

Benthos-input-grpc - gRPC custom benthos input

gRPC custom benthos input Create a custom benthos input that receives messages f

Go-grpc-template - A small template for quickly bootstrapping a, developer platform independent gRPC golang application
Go-grpc-template - A small template for quickly bootstrapping a, developer platform independent gRPC golang application

go-grpc-template A small template for quickly bootstrapping a developer platform

Comments
  • Add ConditionalOrders Service

    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 :)

    opened by atakanyenel 3
  • Default user profile

    Default user profile

    After any Github user change their username, profile.tpl and leaderboard.tpl files in the frontend folder are not able to get the images (they get 404 error). For this reason, I have set a default image for the Github user who has changed their username by default.

    opened by emrekasg 1
Owner
null
protoc-gen-grpc-gateway-ts is a Typescript client generator for the grpc-gateway project. It generates idiomatic Typescript clients that connect the web frontend and golang backend fronted by grpc-gateway.

protoc-gen-grpc-gateway-ts protoc-gen-grpc-gateway-ts is a Typescript client generator for the grpc-gateway project. It generates idiomatic Typescript

gRPC Ecosystem 94 Dec 19, 2022
Educational project to build a p2p network

Template go Repository tl;dr This is a template go repository with actions already set up to create compiled releases What does this Template provide?

Marco Siebecke 0 Dec 2, 2021
Server and client implementation of the grpc go libraries to perform unary, client streaming, server streaming and full duplex RPCs from gRPC go introduction

Description This is an implementation of a gRPC client and server that provides route guidance from gRPC Basics: Go tutorial. It demonstrates how to u

Joram Wambugu 0 Nov 24, 2021
Go-grpc - This is grpc server for golang.

go-grpc This is grpc server for golang. protocのインストール brew install protoc Golang用のプラグインのインストール go install google.golang.org/protobuf/cmd/protoc-gen-go

jotaro yuza 1 Jan 2, 2022
GRPC - A client-server mockup, using gRPC to expose functionality.

gRPC This is a mockup application that I built to help me visualise and understand the basic concepts of gRPC. In this exchange, the client can use a

Fergal Bittles 0 Jan 4, 2022
Go-grpc-tutorial - Simple gRPC server/client using go

Simple gRPC server/client using go Run server go run usermgmt_server/usermgmt_

Renner Poveda 0 Feb 14, 2022
Certified paper with golang

Certified paper with golang

Borankux 0 Nov 14, 2021
Go based grpc - grpc gateway micro service example

go-grpc-gateway-server This repository provides an example for go based microservice. Go micro services developed based on gRPC protobuf's and also us

Suresh Yekasiri 0 Dec 8, 2021
FAT - FAT Trading BOT For Golang

FAT Trading BOT Library Web Frimework Gin Gonic installed (version v1.7.7) A SQL

Ilham Fatiri 1 Jun 23, 2022
A suite of gRPC debugging tools. Like Fiddler/Charles but for gRPC.

grpc-tools A suite of tools for gRPC debugging and development. Like Fiddler/Charles but for gRPC! The main tool is grpc-dump which transparently inte

Bradley Kemp 1.1k Dec 22, 2022