Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nikkhvat/candlestick-charts

Microservice that writes Forex data to the database and converts them to candlestick charts
https://github.com/nikkhvat/candlestick-charts

candlestick-chart forex forex-data golang microservice postgresql websocket

Last synced: about 1 month ago
JSON representation

Microservice that writes Forex data to the database and converts them to candlestick charts

Awesome Lists containing this project

README

        

![bars](./bars.png)

# Forex Data ๐Ÿš€

forex (golang) - Microservice that works with Streaming API Key
- โœ… Getting real-time data (websocket)
- โœ… Proxy web socket server for data
- โœ… Save data to db (PostgreSQL)
- โœ… History rest request (Generate Candlestick chart) (GET) /?startDate /?endDate /?symbol /?timeframe
- โœ… Get up-to-date data now /?symbol

Raw socket data
```json
{
"symbol": "LTCUSD",
"ts": "1660694052026",
"bid": 61.348,
"ask": 61.353,
"mid": 61.350502
}
```

Candlestick chart Data
```json
[{
"open": 61.5284602,
"close": 61.5655,
"high": 61.600502,
"low": 61.5284602,
"timestamp": 1660571731680
}]
```

## Requests

### Request example getting historical data

GET -> `https://domain/forex/hostory?start_date=1660567220494&end_date=1660567787724&symbol=ETHUSD&timeframe=60`
- end_date - end date (timestamp)
- start_date - start date (timestamp)
- symbol - currency pair
- timeframe - in seconds

### Example getting up-to-date data now by symbol

GET -> `https://domain/forex/actual?symbol=ETHUSD`
- symbol - currency pair

### Example ping

GET -> `https://domain/forex/ping`

### Example socket

WS -> `wss://domain:3495/forexws`

## Run

in `.env` file:

```.env
key=qwerft_wedrftg
nominals=EURCAD,EURUSD,GBPAUD,AUDCHF,CHFJPY,EURNZD
```

>key - Streaming API Key

>nominals - ะกomma-separated list of currency pair

run on port: `3495`

Before launching, create a database in PostgreSql
```sql
CREATE DATABASE forex;
```