Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

⚠️⚠️⚠️⚠️⚠️


This project is not maintained anymore! Please check here for alternatives. This repository is kept online for reference purposes only and can be taken offline/deleted any time.


⚠️⚠️⚠️⚠️⚠️


Order Server

Go Report Card

This service for Element43 takes market data off the orders queue from NSQ (generated by emdr-to-nsq) and stores it for later retrieval via the API. The orders are stored as Snappy compressed JSON strings bundled by market (regionID+typeID) in a PostgreSQL instance.

Installation

Either use the prebuilt Docker images and pass the appropriate env vars (see below), or:

  • Clone this repo into your gopath
  • Run go get
  • Run go build

Deployment Info

Builds and releases are handled by Drone.

Environment Variable Default Description
LOG_LEVEL info Threshold for logging messages to be printed
PORT 8000 Port for the API to listen on
NSQ_URL nsqd:4150 Hostname/IP of the NSQD instance to connect to
POSTGRES_URL postgres://order-server@localhost:5432/order-server?sslmode=disable URL to this service's Postgres database

Todo

  • Improve compression story, no gzip support so far (saves CPU time)
  • Add proper caching backend (dynamic invalidation as new market data comes in)
  • General code cleanup (this is my second Go project), add performance metrics collection

Endpoints

Prefix: /api/orders/v1

URL Pattern Description
/region/:regionID/ Get all orders in a region - this can be a lot of data, think around 60MB of JSON for The Forge!
/type/:typeID/ Get all orders of a type
/region/:regionID/type/:typeID/ Get all orders of a type in a region. Similar to the market view in game

The return values share a similar schema. Truncated example output for api/orders/v1/region/10000002/type/34/:

[
    {
        "orderID": 3664144403,
        "regionID": 10000002,
        "typeID": 34,
        "generatedAt": "2017-03-18T12:28:24+00:00",
        "price": 3.35,
        "volRemaining": 102824006,
        "range": 0,
        "volEntered": 120000000,
        "minVolume": 1,
        "bid": true,
        "issueDate": "2017-03-16T09:26:33+00:00",
        "duration": 90,
        "stationID": 60001873,
        "solarSystemID": 30000165
    },
    {
        "orderID": 4647080938,
        "regionID": 10000002,
        "typeID": 34,
        "generatedAt": "2017-03-18T12:28:24+00:00",
        "price": 0.07,
        "volRemaining": 99582322,
        "range": 0,
        "volEntered": 100000000,
        "minVolume": 1,
        "bid": true,
        "issueDate": "2017-02-13T14:38:29+00:00",
        "duration": 90,
        "stationID": 60003760,
        "solarSystemID": 30000142
    }
]

About

DEPRECATED - Market data API for Element43

Resources

License

Releases

No releases published

Packages

No packages published

Languages