omsfeed
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

omsfeed

Build Status Known Vulnerabilities

Server-side of pet project for private needs.

Express app to retrieve precious metals (au, ag, pt, pd) daily quotes (from local bank), store them in MongoDB and provide API on top.

Demo

Output Live Demo

JSON sample
[
    {
        "date": "2018-12-03T00:00:00.000Z",
        "code": 959,
        "asset": "au",
        "sellByn": 86.9253,
        "buyByn": 81.8772,
        "sellUsd": 40.81,
        "buyUsd": 38.44
    },
    {
        "date": "2018-12-03T00:00:00.000Z",
        "code": 961,
        "asset": "ag",
        "sellByn": 1.0309,
        "buyByn": 0.9521,
        "sellUsd": 0.484,
        "buyUsd": 0.447
    },
    {
        "date": "2018-12-03T00:00:00.000Z",
        "code": 962,
        "asset": "pt",
        "sellByn": 57.6591,
        "buyByn": 53.2287,
        "sellUsd": 27.07,
        "buyUsd": 24.99
    },
    {
        "date": "2018-12-03T00:00:00.000Z",
        "code": 964,
        "asset": "pd",
        "sellByn": 86.4993,
        "buyByn": 78.2775,
        "sellUsd": 40.61,
        "buyUsd": 36.75
    }
]

Building blocks, Credits

API

Endpoints:

  • /quotes/<asset>?date=[YYYY-MM-DD] - single date quotes, asset (au, ag, pt, pd) is optional
  • /quotes/<asset>?startDate=[YYYY-MM-DD] - date range quotes, asset and endDate are optional
  • TODO: normalized buy/sell (spread is increased on non-working days and hours).

Examples:

Tools

Available as npm scripts:

Configuration

Default MongoDB connection options that could be overridden with environment variables:

  • connection string: mongodb://localhost:27017 (env MONGO_OMS_URI)
  • database name: oms (env MONGO_OMS_DB)
  • collection name: asset-quotes (env MONGO_OMS_COLLECTION)
  • logs collection name: request-logs (env MONGO_OMS_COLLECTION_LOGS)

Running locally

git clone https://github.com/pmstss/omsfeed
cd omsfeed
npm install
npm run build
npm run start

or

npm install omsfeed
node node_modules/omsfeed/dist/server.js

Contribution

Feel free to contribute by opening issues with any questions, ideas or feature requests.

License

MIT

Package Sidebar

Install

npm i omsfeed

Weekly Downloads

4

Version

1.0.4

License

MIT

Unpacked Size

50.6 kB

Total Files

46

Last publish

Collaborators

  • pmstss