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.
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.
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
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 |
- 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
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
}
]