Documentation ¶
Index ¶
- Constants
- type AddMarginRequest
- type AddMarginResponse
- type BidAndOfferHistoryResponse
- type CancelAllResponse
- type CancelResponse
- type CarryFeesHistoryResponse
- type CashInResponse
- type CloseAllResponse
- type CloseResponse
- type FixingHistoryResponse
- type IndexHistoryResponse
- type InstrumentResponse
- type LNMarkets
- func (api *LNMarkets) AddMargin(amount int64, pid string) (*AddMarginResponse, error)
- func (api *LNMarkets) Cancel(pid string) (*CancelResponse, error)
- func (api *LNMarkets) CancelAll() (*CancelAllResponse, error)
- func (api *LNMarkets) CarryFeesHistory(from int64, to int64, limit int64) (*CarryFeesHistoryResponse, error)
- func (api *LNMarkets) CashIn(pid string) (*CashInResponse, error)
- func (api *LNMarkets) Close() (*CloseResponse, error)
- func (api *LNMarkets) CloseAll() (*CloseAllResponse, error)
- func (api *LNMarkets) NewPosition(t OrderType, s OrderSide, p float64, m int, sl, tp, q, l float64) (*NewPositionResponse, error)
- func (api *LNMarkets) Positions() (*PositionsResponse, error)
- func (api *LNMarkets) Ticker() (*TickerResponse, error)
- func (api *LNMarkets) User() (*UserResponse, error)
- type LNMarketsResponse
- type NewPositionRequest
- type NewPositionResponse
- type OrderSide
- type OrderType
- type PositionsResponse
- type TickerResponse
- type UpdateResponse
- type UserResponse
Constants ¶
const ( // Url - LNMarkets rest API Endpoint Url = "https://api.lnmarkets.com" // Version - LNMarkets API Version Number Version = "v1" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddMarginRequest ¶
type AddMarginResponse ¶
type AddMarginResponse struct { Pid string `json:"pid"` ID int `json:"id"` Type string `json:"type"` TakeprofitWi string `json:"takeprofit_wi"` Takeprofit int `json:"takeprofit"` StoplossWi string `json:"stoploss_wi"` Stoploss int `json:"stoploss"` Side string `json:"side"` Quantity int `json:"quantity"` Price int `json:"price"` Pl int `json:"pl"` MarketWi string `json:"market_wi"` MarketFilledTs string `json:"market_filled_ts"` MarginWi string `json:"margin_wi"` Margin int `json:"margin"` Liquidation int `json:"liquidation"` Leverage int `json:"leverage"` CreationTs string `json:"creation_ts"` }
type CancelAllResponse ¶
type CancelResponse ¶
type CancelResponse struct {
Pid string `json:"pid"`
}
type CashInResponse ¶
type CloseAllResponse ¶
type CloseAllResponse CancelAllResponse
type CloseResponse ¶
type FixingHistoryResponse ¶
type IndexHistoryResponse ¶
type InstrumentResponse ¶
type LNMarkets ¶
type LNMarkets struct {
// contains filtered or unexported fields
}
LNMarkets - object wraps API
func (*LNMarkets) AddMargin ¶
func (api *LNMarkets) AddMargin(amount int64, pid string) (*AddMarginResponse, error)
AddMargin - Add margin to a running position.
func (*LNMarkets) Cancel ¶
func (api *LNMarkets) Cancel(pid string) (*CancelResponse, error)
Cancel - Cancel the position linked to the given pid. Only works on positions that are not currently filled.
func (*LNMarkets) CancelAll ¶
func (api *LNMarkets) CancelAll() (*CancelAllResponse, error)
CancelAll - Cancel all open positions.
func (*LNMarkets) CarryFeesHistory ¶
func (api *LNMarkets) CarryFeesHistory(from int64, to int64, limit int64) (*CarryFeesHistoryResponse, error)
CarryFeesHistory - Retrieves carry fees for user.
func (*LNMarkets) CashIn ¶
func (api *LNMarkets) CashIn(pid string) (*CashInResponse, error)
CashIn - Retrieves part of one running positions PL.
func (*LNMarkets) Close ¶
func (api *LNMarkets) Close() (*CloseResponse, error)
Close - Close the user position. The PL will be calculated against the current bid or offer depending on the side of the position.
func (*LNMarkets) CloseAll ¶
func (api *LNMarkets) CloseAll() (*CloseAllResponse, error)
CloseAll - Close every user position. The PL will be calculated against the current bid or offer depending on the side of the position.
func (*LNMarkets) NewPosition ¶
func (api *LNMarkets) NewPosition(t OrderType, s OrderSide, p float64, m int, sl, tp, q, l float64) (*NewPositionResponse, error)
NewPosition - Send the order form parameters to add a new position in database. If type="l", the property price must be included in the request to know when the position should be filled. You can choose to use the margin or the quantity as a parameter, the other will be calculated with the one you chose.
func (*LNMarkets) Positions ¶
func (api *LNMarkets) Positions() (*PositionsResponse, error)
Positions - Fetch users positions.
func (*LNMarkets) Ticker ¶
func (api *LNMarkets) Ticker() (*TickerResponse, error)
Ticker - Retrieves the futures ticker.
func (*LNMarkets) User ¶
func (api *LNMarkets) User() (*UserResponse, error)
User - Get the user account Information.
type LNMarketsResponse ¶
type LNMarketsResponse struct { Result interface{} Error struct { Error interface{} `json:"error"` } }
type NewPositionRequest ¶
type NewPositionResponse ¶
type NewPositionResponse struct { Pid string `json:"pid"` ID int `json:"id"` Type string `json:"type"` TakeprofitWi string `json:"takeprofit_wi"` Takeprofit float64 `json:"takeprofit"` StoplossWi string `json:"stoploss_wi"` Stoploss float64 `json:"stoploss"` Side string `json:"side"` Quantity float64 `json:"quantity"` Price float64 `json:"price"` Pl float64 `json:"pl"` MarketWi string `json:"market_wi"` MarketFilledTs string `json:"market_filled_ts"` MarginWi string `json:"margin_wi"` Margin int `json:"margin"` Liquidation float64 `json:"liquidation"` Leverage float64 `json:"leverage"` CreationTs string `json:"creation_ts"` }
type PositionsResponse ¶
type PositionsResponse struct { Positions []struct { Pid string `json:"pid"` ID int `json:"id"` Type string `json:"type"` TakeprofitWi string `json:"takeprofit_wi"` Takeprofit int `json:"takeprofit"` StoplossWi string `json:"stoploss_wi"` Stoploss int `json:"stoploss"` Sign int `json:"sign"` Side string `json:"side"` Quantity int `json:"quantity"` Price int `json:"price"` Pl int `json:"pl"` MarketWi string `json:"market_wi"` MarketFilledTs int64 `json:"market_filled_ts"` MarginWi string `json:"margin_wi"` Margin int `json:"margin"` Liquidation int `json:"liquidation"` Leverage int `json:"leverage"` ExitPrice int `json:"exit_price"` CreationTs int64 `json:"creation_ts"` ClosedTs int64 `json:"closed_ts"` Closed bool `json:"closed"` Canceled bool `json:"canceled"` SumCarryFees int `json:"sum_carry_fees"` } `json:"positions"` }