90 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			90 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| # Requirements
 | |
| 
 | |
| Tickers of interest:
 | |
| - EURUSD
 | |
| - USDJPY
 | |
| - GBPUSD
 | |
| - AUDUSD
 | |
| - USDCAD
 | |
| 
 | |
| Rest API - https://rates.emcont.com
 | |
| 
 | |
| Scrape every second;
 | |
| 
 | |
| Schema:
 | |
| 	Ticker:
 | |
| 		id: foreign_key market
 | |
| 		timestamp: datetime
 | |
| 		# (ask + bid) / 2
 | |
| 		value: decimal
 | |
| 
 | |
| Store up to 30 minutes of recent tickers;
 | |
| 
 | |
| Return via websocket up to 30 minutes of recent tickers;
 | |
| 
 | |
| # AsyncAPI
 | |
| 
 | |
| ```yaml
 | |
| AsyncAPI:
 | |
| 	Endpoints:
 | |
| 		subscribe:
 | |
| 			Request: SubscribeAction
 | |
| 			Response: AssetHistoryResponse | AssetTickerResponse
 | |
| 		list:
 | |
| 			Request: AssetsAction
 | |
| 			Response: AssetsResponse
 | |
| 	Schema:
 | |
| 		SubscribeAction:
 | |
| 			action: Literal['subscribe']
 | |
| 			message:
 | |
| 				assetId: 1
 | |
| 		AssetHistoryResponse:
 | |
| 			action: Literal['asset_history']
 | |
| 			message:
 | |
| 				points:
 | |
| 					- assetName: EURUSD
 | |
| 						time: 1455883484
 | |
| 						assetId: 1
 | |
| 						value: 1.110481
 | |
| 					- assetName: EURUSD
 | |
| 						time: 1455883485
 | |
| 						assetId: 1
 | |
| 						value: 1.110948
 | |
| 					- assetName: EURUSD
 | |
| 						time: 1455883486
 | |
| 						assetId: 1
 | |
| 						value: 1.111122
 | |
| 		AssetTickerResponse:
 | |
| 			action: Literal['point']
 | |
| 			message:
 | |
| 				assetName: EURUSD
 | |
| 				time: 1455883484
 | |
| 				assetId: 1
 | |
| 				value: 1.110481
 | |
| 		AssetsAction:
 | |
| 			action: Literal['assets']
 | |
| 			message: {}
 | |
| 		AssetsResponse:
 | |
| 			action: Literal['assets']
 | |
| 			message:
 | |
| 				assets:
 | |
| 					- id: 1
 | |
| 						name: EURUSD
 | |
| 					- id: 2
 | |
| 						name: USDJPY
 | |
| 					- id: 3
 | |
| 						name: GBPUSD
 | |
| 					- id: 4
 | |
| 						name: AUDUSD
 | |
| 					- id: 5
 | |
| 						name: USDCAD
 | |
| ```
 | |
| 
 | |
| # Services:
 | |
| 
 | |
| ``` yaml
 | |
| web:
 | |
| 	ports:
 | |
| 		- 8080:80
 | |
| ```
 |