binance-exports-0.1.2.0: Generate CSV Exports of your Binance Trade History.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Web.Binance

Description

Request functions & response types for the Binance.US API

Synopsis

API

data BinanceApiM a Source #

The monad in which Binance API requests are run.

Instances

Instances details
MonadIO BinanceApiM Source # 
Instance details

Defined in Web.Binance

Methods

liftIO :: IO a -> BinanceApiM a #

Applicative BinanceApiM Source # 
Instance details

Defined in Web.Binance

Methods

pure :: a -> BinanceApiM a #

(<*>) :: BinanceApiM (a -> b) -> BinanceApiM a -> BinanceApiM b #

liftA2 :: (a -> b -> c) -> BinanceApiM a -> BinanceApiM b -> BinanceApiM c #

(*>) :: BinanceApiM a -> BinanceApiM b -> BinanceApiM b #

(<*) :: BinanceApiM a -> BinanceApiM b -> BinanceApiM a #

Functor BinanceApiM Source # 
Instance details

Defined in Web.Binance

Methods

fmap :: (a -> b) -> BinanceApiM a -> BinanceApiM b #

(<$) :: a -> BinanceApiM b -> BinanceApiM a #

Monad BinanceApiM Source # 
Instance details

Defined in Web.Binance

Methods

(>>=) :: BinanceApiM a -> (a -> BinanceApiM b) -> BinanceApiM b #

(>>) :: BinanceApiM a -> BinanceApiM b -> BinanceApiM b #

return :: a -> BinanceApiM a #

MonadCatch BinanceApiM Source # 
Instance details

Defined in Web.Binance

Methods

catch :: Exception e => BinanceApiM a -> (e -> BinanceApiM a) -> BinanceApiM a #

MonadThrow BinanceApiM Source # 
Instance details

Defined in Web.Binance

Methods

throwM :: Exception e => e -> BinanceApiM a #

MonadHttp BinanceApiM Source #

Use MonadHttp from the Req instance.

Instance details

Defined in Web.Binance

MonadReader BinanceConfig BinanceApiM Source # 
Instance details

Defined in Web.Binance

runApi :: BinanceConfig -> BinanceApiM a -> IO a Source #

Run a series of API requests with the given Config.

Requests

Exchange Info

getExchangeInfo :: (MonadHttp m, MonadCatch m) => [Text] -> m (Either BinanceError ExchangeInfo) Source #

Get Exchange Information for the Given Symbol. Right now, just returns the requested symbol information.

Returns Left if a passed symbol is invalid.

newtype ExchangeInfo Source #

General information about the exchange. Currently we only parse out the details of requested symbols.

Constructors

ExchangeInfo 

Trade History

getTradeHistory Source #

Arguments

:: (MonadHttp m, MonadReader BinanceConfig m) 
=> Text

Full symbol/pair of trades to fetch, e.g. BNBUSD.

-> Maybe UTCTime

Start of time range

-> Maybe UTCTime

End of time range

-> m [Trade] 

Get Trade History for the Given Symbol.

data Trade Source #

A single trade made on Binance.

Constructors

Trade 

Fields

Instances

Instances details
FromJSON Trade Source # 
Instance details

Defined in Web.Binance

Read Trade Source # 
Instance details

Defined in Web.Binance

Show Trade Source # 
Instance details

Defined in Web.Binance

Methods

showsPrec :: Int -> Trade -> ShowS #

show :: Trade -> String #

showList :: [Trade] -> ShowS #

Eq Trade Source # 
Instance details

Defined in Web.Binance

Methods

(==) :: Trade -> Trade -> Bool #

(/=) :: Trade -> Trade -> Bool #

Ord Trade Source # 
Instance details

Defined in Web.Binance

Methods

compare :: Trade -> Trade -> Ordering #

(<) :: Trade -> Trade -> Bool #

(<=) :: Trade -> Trade -> Bool #

(>) :: Trade -> Trade -> Bool #

(>=) :: Trade -> Trade -> Bool #

max :: Trade -> Trade -> Trade #

min :: Trade -> Trade -> Trade #

Helpers

runSignedRequest :: (MonadHttp m, HttpMethod method, HttpBody body, HttpResponse response, HttpBodyAllowed (AllowsBody method) (ProvidesBody body), MonadReader BinanceConfig m) => method -> Url scheme -> body -> Proxy response -> Option scheme -> m response Source #

Run a request for a SIGNED endpoint by inserting the signature into the query string before making the request.

mkSignature Source #

Arguments

:: BinanceConfig

API Credentials

-> ByteString

Query parameters (with no leading ?)

-> ByteString

Request body

-> ByteString 

Generate a HMAC Crpto.Hash.SHA256 signature for a SIGNED api request.