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
{
"symbol": "LTCUSD",
"ts": "1660694052026",
"bid": 61.348,
"ask": 61.353,
"mid": 61.350502
}
Candlestick chart Data
[{
"open": 61.5284602,
"close": 61.5655,
"high": 61.600502,
"low": 61.5284602,
"timestamp": 1660571731680
}]
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
GET -> https://domain/forex/actual?symbol=ETHUSD
- symbol - currency pair
GET -> https://domain/forex/ping
WS -> wss://domain:3495/forexws
in .env
file:
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
CREATE DATABASE forex;