Copyright | No Rights Reserved |
---|---|
License | Public Domain |
Maintainer | Tebello Thejane <zyxoas+hackage@gmail.com> |
Stability | Experimental |
Portability | non-portable (GHC Extensions) |
Safe Haskell | None |
Language | Haskell2010 |
The types used for the various BitX API calls.
Note that these are all record
types, as provided by Nikita Volkov's
Record library. The main motivation for using the record
library was
to avoid using record field prefixes and other awkward hacks to get around
the fact that Haskell does not yet have a real records' system.
For example, the declaration of BitXError
is
type BitXAuth = [record
| {id ::Text
, secret ::Text
} |]
To declare a BitXAuth, one might use
myAuth :: BitXAuth myAuth = [record| {id = "46793", secret = "387ffBd56eEAA7C59"} |]
and to read the fields you would use
theID =view
[lens
| id |] myAuth
Note that all uses of Volkov's record
s requires importing Record and
enabling the DataKinds
and QuasiQuotes
extensions.
- type Ticker = Record6 "ask" Decimal "bid" Decimal "lastTrade" Decimal "pair" CcyPair "rolling24HourVolume" Decimal "timestamp" UTCTime
- data CcyPair
- type Orderbook = Record3 "asks" [Ask] "bids" [Bid] "timestamp" UTCTime
- type Order = Record2 "price" Decimal "volume" Decimal
- type Bid = Order
- type Ask = Order
- type Trade = Record3 "price" Decimal "timestamp" UTCTime "volume" Decimal
- type BitXAuth = Record2 "id" Text "secret" Text
- type PrivateOrder = Record12 "base" Decimal "counter" Decimal "creationTimestamp" UTCTime "expirationTimestamp" UTCTime "feeBase" Decimal "feeCounter" Decimal "id" OrderID "limitPrice" Decimal "limitVolume" Decimal "pair" CcyPair "state" RequestStatus "type" OrderType
- type OrderID = Text
- data OrderType
- data RequestStatus
- type OrderRequest = Record4 "pair" CcyPair "price" Decimal "type" OrderType "volume" Decimal
- type RequestSuccess = Bool
- type BitXError = Record2 "error" Text "errorCode" Text
- type PrivateOrderWithTrades = Record13 "base" Decimal "counter" Decimal "creationTimestamp" UTCTime "expirationTimestamp" UTCTime "feeBase" Decimal "feeCounter" Decimal "id" OrderID "limitPrice" Decimal "limitVolume" Decimal "pair" CcyPair "state" RequestStatus "trades" [Trade] "type" OrderType
- type AccountID = Text
- data Asset
- type Balance = Record5 "asset" Asset "balance" Decimal "id" AccountID "reserved" Decimal "unconfirmed" Decimal
- type FundingAddress = Record4 "address" Text "asset" Asset "totalReceived" Decimal "totalUnconfirmed" Decimal
- type WithdrawalRequest = Record2 "id" Text "status" RequestStatus
- type NewWithdrawal = Record2 "amount" Decimal "type" WithdrawalType
- data WithdrawalType
- type BitcoinSendRequest = Record5 "address" Text "amount" Decimal "currency" Asset "description" (Maybe Text) "message" (Maybe Text)
- type QuoteRequest = Record3 "baseAmount" Decimal "pair" CcyPair "type" QuoteType
- type OrderQuote = Record9 "baseAmount" Decimal "counterAmount" Decimal "createdAt" UTCTime "discarded" Bool "exercised" Bool "expiresAt" UTCTime "id" Text "pair" CcyPair "type" QuoteType
- data QuoteType
- type BitXClientAuth = BitXAuth
- type Transaction = Record8 "available" Decimal "availableDelta" Decimal "balance" Decimal "balanceDelta" Decimal "currency" Asset "description" Text "rowIndex" Int "timestamp" UTCTime
Documentation
type Ticker = Record6 "ask" Decimal "bid" Decimal "lastTrade" Decimal "pair" CcyPair "rolling24HourVolume" Decimal "timestamp" UTCTime Source
The state of a single market, identified by the currency pair.
As usual, the ask/sell price is the price of the last filled ask order, and the bid/buy price is
the price of the last filled bid order. Necessarily bid <= ask.
type Ticker = [record| {ask ::Decimal
, timestamp ::UTCTime
, bid ::Decimal
, rolling24HourVolume ::Decimal
, lastTrade ::Decimal
, pair ::CcyPair
} |]
A currency pair
type PrivateOrder = Record12 "base" Decimal "counter" Decimal "creationTimestamp" UTCTime "expirationTimestamp" UTCTime "feeBase" Decimal "feeCounter" Decimal "id" OrderID "limitPrice" Decimal "limitVolume" Decimal "pair" CcyPair "state" RequestStatus "type" OrderType Source
A recently placed (private) order, containing a lot more information than is available on the public order book.
type PrivateOrder = [record| {base ::Decimal
, counter ::Decimal
, creationTimestamp ::UTCTime
, expirationTimestamp ::UTCTime
, feeBase ::Decimal
, feeCounter ::Decimal
, limitPrice ::Decimal
, limitVolume ::Decimal
, id ::OrderID
, pair ::CcyPair
, state ::RequestStatus
, type ::OrderType
} |]
The type of a placed order.
data RequestStatus Source
The state of a (private) placed request -- either an order or a withdrawal request.
type RequestSuccess = Bool Source
type BitXError = Record2 "error" Text "errorCode" Text Source
A possible error which the BitX API might return, instead of returning the requested data. Note that as yet there is no exhaustive list of error codes available, so comparisons will have to be done via Text comparisons (as opposed to typed pattern matching). Sorry...
type BitXError = [record| {error ::Text
, errorCode ::Text
} |]
type PrivateOrderWithTrades = Record13 "base" Decimal "counter" Decimal "creationTimestamp" UTCTime "expirationTimestamp" UTCTime "feeBase" Decimal "feeCounter" Decimal "id" OrderID "limitPrice" Decimal "limitVolume" Decimal "pair" CcyPair "state" RequestStatus "trades" [Trade] "type" OrderType Source
A recently placed (private) order, containing a lot more information than is available on the public order book, together with details of any trades which have (partially) filled it.
type PrivateOrderWithTrades = [record| {base ::Decimal
, counter ::Decimal
, creationTimestamp ::UTCTime
, expirationTimestamp ::UTCTime
, feeBase ::Decimal
, feeCounter ::Decimal
, limitPrice ::Decimal
, limitVolume ::Decimal
, id ::OrderID
, pair ::CcyPair
, state ::RequestStatus
, type ::OrderType
, trades :: [Trade
] } |]
A trade-able asset. Essentially, a currency.
type Balance = Record5 "asset" Asset "balance" Decimal "id" AccountID "reserved" Decimal "unconfirmed" Decimal Source
type FundingAddress = Record4 "address" Text "asset" Asset "totalReceived" Decimal "totalUnconfirmed" Decimal Source
type WithdrawalRequest = Record2 "id" Text "status" RequestStatus Source
The state of a request to withdraw from an account.
type WithdrawalRequest = [record| {status ::RequestStatus
, id ::Text
} |]
type NewWithdrawal = Record2 "amount" Decimal "type" WithdrawalType Source
A request to withdraw from an account.
type NewWithdrawal = [record| {type ::WithdrawalType
, amount ::Decimal
} |]
data WithdrawalType Source
The type of a withdrawal request.
type BitcoinSendRequest = Record5 "address" Text "amount" Decimal "currency" Asset "description" (Maybe Text) "message" (Maybe Text) Source
type OrderQuote = Record9 "baseAmount" Decimal "counterAmount" Decimal "createdAt" UTCTime "discarded" Bool "exercised" Bool "expiresAt" UTCTime "id" Text "pair" CcyPair "type" QuoteType Source
type BitXClientAuth = BitXAuth Source