-
Notifications
You must be signed in to change notification settings - Fork 16
/
Environment.hs
45 lines (26 loc) · 987 Bytes
/
Environment.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
module CoinbasePro.Environment
( Environment (..)
, WSConnection (..)
, apiEndpoint
, wsEndpoint
) where
import Network.Socket (HostName, PortNumber)
data Environment = Production | Sandbox
apiEndpoint :: Environment -> String
apiEndpoint Production = productionAPIEndpoint
apiEndpoint Sandbox = sandboxAPIEndpoint
productionAPIEndpoint :: String
productionAPIEndpoint = "api.pro.coinbase.com"
sandboxAPIEndpoint :: String
sandboxAPIEndpoint = "api-public.sandbox.pro.coinbase.com"
data WSConnection = WSConnection
{ host :: HostName
, port :: PortNumber
} deriving (Eq, Show)
wsEndpoint :: Environment -> WSConnection
wsEndpoint Production = productionWSEndpoint
wsEndpoint Sandbox = sandboxWSEndpoint
productionWSEndpoint :: WSConnection
productionWSEndpoint = WSConnection "ws-feed.pro.coinbase.com" 443
sandboxWSEndpoint :: WSConnection
sandboxWSEndpoint = WSConnection "ws-feed-public.sandbox.pro.coinbase.com" 443