bitfinexcom / bitfinex-api-go

BITFINEX Go trading API - Bitcoin, Litecoin, and Ether exchange
https://www.bitfinex.com/
MIT License
310 stars 220 forks source link

Feature/types refactor and fixes #217

Closed Daniel1984 closed 4 years ago

Daniel1984 commented 4 years ago

Description:

Splitting legacy types.go into small modules. Each test covered and refactored to follow certain patterns. Unused/dead code cleanup.

Breaking changes:

- bitfinex.OrderFlagHidden -> common.FundingPrefix
- bitfinex.OrderFlagClose -> common.OrderFlagClose
- bitfinex.OrderFlagPostOnly -> common.OrderFlagPostOnly
- bitfinex.OrderFlagOCO -> common.OrderFlagOCO
- bitfinex.Checksum -> common.Checksum
- bitfinex.OrderTypeExchangeLimit -> common.OrderTypeExchangeLimit
- bitfinex.PermissionRead -> common.PermissionRead
- bitfinex.PermissionWrite -> common.PermissionWrite
- bitfinex.FundingPrefix -> common.FundingPrefix
- bitfinex.TradingPrefix -> common.TradingPrefix
- bitfinex.FundingSizeKey -> common.FundingSizeKey
- bitfinex.CreditSizeKey -> common.CreditSizeKey
- bitfinex.CreditSizeSymKey -> common.CreditSizeSymKey
- bitfinex.PositionSizeKey -> common.PositionSizeKey
- bitfinex.Bid -> common.Bid
- bitfinex.Ask -> common.Ask
- bitfinex.Long -> common.Long
- bitfinex.Short -> common.Short
- bitfinex.OldestFirst -> common.OldestFirst
- bitfinex.NewestFirst -> common.NewestFirst
- bitfinex.OneMinute -> common.OneMinute
- bitfinex.FiveMinutes -> common.FiveMinutes
- bitfinex.FifteenMinutes -> common.FifteenMinutes
- bitfinex.ThirtyMinutes -> common.ThirtyMinutes
- bitfinex.OneHour -> common.OneHour
- bitfinex.ThreeHours -> common.ThreeHours
- bitfinex.SixHours -> common.SixHours
- bitfinex.TwelveHours -> common.TwelveHours
- bitfinex.OneDay -> common.OneDay
- bitfinex.OneWeek -> common.OneWeek
- bitfinex.TwoWeeks -> common.TwoWeeks
- bitfinex.OneMonth -> common.OneMonth
- bitfinex.Precision0 -> common.Precision0
- bitfinex.Precision1 -> common.Precision1
- bitfinex.Precision2 -> common.Precision2
- bitfinex.Precision3 -> common.Precision3
- bitfinex.PrecisionRawBook -> common.PrecisionRawBook
- bitfinex.FrequencyRealtime -> common.FrequencyRealtime
- bitfinex.FrequencyTwoPerSecond -> common.FrequencyTwoPerSecond
- bitfinex.PriceLevelDefault -> common.PriceLevelDefault
- bitfinex.ErrNotFound -> common.ErrNotFound
- bitfinex.OrderSide -> common.OrderSide
- bitfinex.CandleResolution -> common.CandleResolution
- bitfinex.BookPrecision -> common.BookPrecision
- bitfinex.BookFrequency -> common.BookFrequency
- bitfinex.SortOrder -> common.SortOrder
- bitfinex.QueryLimit -> common.QueryLimit
- bitfinex.PermissionType -> common.PermissionType
- bitfinex.Mts -> common.Mts
- bitfinex.StatKey -> common.StatKey
- bitfinex.StatusType -> common.StatusType
- bitfinex.CandleResolutionFromString -> common.CandleResolutionFromString
- bitfinex.OrderNewRequest -> order.NewRequest
- bitfinex.OrderUpdateRequest -> order.UpdateRequest
- bitfinex.OrderCancelRequest -> order.CancelRequest
- bitfinex.Order -> order.Order
- bitfinex.NewOrderFromRaw -> order.FromRaw
- bitfinex.NewOrderSnapshotFromRaw -> order.SnapshotFromRaw
- bitfinex.NewOrderSnapshotFromRaw -> order.SnapshotFromRaw
- bitfinex.OrderSnapshot -> order.Snapshot
- bitfinex.OrderUpdate -> order.Update
- bitfinex.OrderNew -> order.New
- bitfinex.OrderCancel -> order.Cancel
- bitfinex.PositionStatus -> position.Status
- bitfinex.Position -> position.Position
- bitfinex.NewPositionFromRaw -> position.FromRaw
- bitfinex.NewPositionSnapshotFromRaw -> position.SnapshotFromRaw
- bitfinex.PositionSnapshot -> position.Snapshot
- bitfinex.PositionNew -> position.New
- bitfinex.PositionUpdate -> position.Update
- bitfinex.PositionCancel -> position.Cancel
- bitfinex.ClaimPositionRequest -> position.ClaimRequest
- bitfinex.Trade -> trade.Trade
- bitfinex.NewTradeFromRaw -> trade.FromRaw
- bitfinex.TradeSnapshot -> trade.Snapshot
- bitfinex.NewTradeSnapshotFromRaw -> trade.SnapshotFromRaw
- bitfinex.TradeExecutionUpdate -> tradeexecutionupdate.TradeExecutionUpdate
- bitfinex.NewTradeExecutionUpdateFromRaw -> tradeexecutionupdate.FromRaw
- bitfinex.TradeExecutionUpdateSnapshot -> tradeexecutionupdate.Snapshot
- bitfinex.HistoricalTradeSnapshot -> tradeexecutionupdate.HistoricalTradeSnapshot
- bitfinex.NewTradeExecutionUpdateSnapshotFromRaw -> tradeexecutionupdate.SnapshotFromRaw
- bitfinex.TradeExecution -> tradeexecution.TradeExecution
- bitfinex.NewTradeExecutionFromRaw -> tradeexecution.FromRaw
- bitfinex.NewTradeExecutionFromRaw -> tradeexecution.FromRaw
- bitfinex.Wallet -> wallet.Wallet
- bitfinex.WalletUpdate -> wallet.Update
- bitfinex.WalletSnapshot -> wallet.Snapshot
- bitfinex.NewWalletFromRaw -> wallet.FromRaw
- bitfinex.NewWalletSnapshotFromRaw -> wallet.SnapshotFromRaw
- bitfinex.NewWalletSnapshotFromRaw -> wallet.SnapshotFromRaw
- bitfinex.BalanceInfo -> balanceinfo.BalanceInfo
- bitfinex.BalanceUpdate -> balanceinfo.Update
- bitfinex.NewBalanceInfoFromRaw -> balanceinfo.FromRaw
- bitfinex.MarginInfoUpdate -> margin.InfoUpdate
- bitfinex.MarginInfoBase -> margin.InfoBase
- bitfinex.NewMarginInfoFromRaw -> margin.FromRaw
- bitfinex.FundingInfo -> fundinginfo.FundingInfo
- bitfinex.NewFundingInfoFromRaw -> fundinginfo.FromRaw
- bitfinex.FundingOfferCancelRequest -> fundingoffer.CancelRequest
- bitfinex.FundingOfferRequest -> fundingoffer.SubmitRequest
- bitfinex.Offer -> fundingoffer.Offer
- bitfinex.NewOfferFromRaw -> fundingoffer.FromRaw
- bitfinex.FundingOfferNew -> fundingoffer.New
- bitfinex.FundingOfferUpdate -> fundingoffer.Update
- bitfinex.FundingOfferCancel -> fundingoffer.Cancel
- bitfinex.FundingOfferSnapshot -> fundingoffer.Snapshot
- bitfinex.FundingOfferSnapshot -> fundingoffer.Snapshot
- bitfinex.NewFundingOfferSnapshotFromRaw -> fundingoffer.SnapshotFromRaw
- bitfinex.Credit -> credit.Credit
- bitfinex.FundingCreditNew -> credit.New
- bitfinex.FundingCreditUpdate -> credit.Update
- bitfinex.FundingCreditCancel -> credit.Cancel
- bitfinex.FundingCreditSnapshot -> credit.Snapshot
- bitfinex.NewCreditFromRaw -> credit.FromRaw
- bitfinex.NewFundingCreditSnapshotFromRaw -> credit.SnapshotFromRaw
- bitfinex.NewFundingCreditSnapshotFromRaw -> credit.SnapshotFromRaw
- bitfinex.Loan -> fundingloan.Loan
- bitfinex.FundingLoanNew -> fundingloan.New
- bitfinex.FundingLoanUpdate -> fundingloan.Update
- bitfinex.FundingLoanCancel -> fundingloan.Cancel
- bitfinex.FundingLoanSnapshot -> fundingloan.Snapshot
- bitfinex.NewLoanFromRaw -> fundingloan.FromRaw
- bitfinex.NewFundingLoanSnapshotFromRaw -> fundingloan.SnapshotFromRaw
- bitfinex.FundingTrade -> fundingtrade.FundingTrade
- bitfinex.FundingTradeExecution -> fundingtrade.Execution
- bitfinex.FundingTradeUpdate -> fundingtrade.Update
- bitfinex.FundingTradeSnapshot -> fundingtrade.Snapshot
- bitfinex.HistoricalFundingTradeSnapshot -> fundingtrade.HistoricalSnapshot
- bitfinex.NewFundingTradeFromRaw -> fundingtrade.FromRaw
- bitfinex.NewFundingTradeSnapshotFromRaw -> fundingtrade.SnapshotFromRaw
- bitfinex.Notification -> notification.Notification
- bitfinex.NewNotificationFromRaw -> notification.FromRaw
- bitfinex.Ticker -> ticker.Ticker
- bitfinex.TickerSnapshot -> ticker.Snapshot
- bitfinex.NewTickerSnapshotFromRaw -> ticker.SnapshotFromRaw
- bitfinex.NewTickerFromRaw -> ticker.FromRaw
- bitfinex.NewTickerFromRestRaw -> ticker.FromRestRaw
- bitfinex.BookUpdate -> book.Book
- bitfinex.BookUpdateSnapshot -> book.Snapshot
- bitfinex.NewBookUpdateSnapshotFromRaw -> book.SnapshotFromRaw
- bitfinex.IsRawBook -> book.IsRawBook
- bitfinex.NewBookUpdateFromRaw -> book.FromRaw
- bitfinex.Candle -> candle.Candle
- bitfinex.CandleSnapshot -> candle.Snapshot
- bitfinex.NewCandleSnapshotFromRaw -> candle.SnapshotFromRaw
- bitfinex.NewCandleFromRaw -> candle.FromRaw
- bitfinex.ToFloat64Slice -> convert.F64Slice
- bitfinex.ToInterface -> convert.ToInterface
- bitfinex.ToInterface -> convert.ToInterface
- bitfinex.Ledger -> ledger.Ledger
- bitfinex.LedgerSnapshot -> ledger.Snapshot
- bitfinex.NewLedgerFromRaw -> ledger.FromRaw
- bitfinex.NewLedgerSnapshotFromRaw -> ledger.SnapshotFromRaw
- bitfinex.CurrencyConf -> currency.Conf
- bitfinex.ExplorerConf -> currency.ExplorerConf
- bitfinex.RawCurrencyConf -> currency.RawConf
- bitfinex.RawConf -> currency.FromRaw
- bitfinex.Stat -> stats.Stat
- bitfinex.DerivativeStatus -> derivatives.DerivativeStatus
- bitfinex.DerivativeStatusSnapshot -> derivatives.Snapshot
- bitfinex.NewDerivativeStatusFromWsRaw -> derivatives.FromWsRaw
- bitfinex.NewDerivativeStatusFromRaw -> derivatives.FromRaw
- bitfinex.NewDerivativeSnapshotFromRaw -> derivatives.SnapshotFromRaw

New features:

- ws2.CloseFundingLoan
- ws2.CloseFundingCredit

Fixes:

- derivatives.DerivativeStatus fixed payload quality check
- convert.F64ValOrZero now returning float64 for non float interface representations instead of 0
- convert.BValOrFalse now correctly maps 0, 1, "0" and "1" to boolean values
- trades resource is now aware of trading and funding pairs and maps data correctly
- book resource is now aware of trading and funding pairs and maps data correctly

PR status: