derivativesapi

package
v0.0.0-...-dd16f27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2020 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "DerivativesAPI"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [2]string{"orders", "postOrder"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func MakeInternal

func MakeInternal(err error) *goa.ServiceError

MakeInternal builds a goa.ServiceError from an error.

func MakeNotFound

func MakeNotFound(err error) *goa.ServiceError

MakeNotFound builds a goa.ServiceError from an error.

func MakeNotImplemented

func MakeNotImplemented(err error) *goa.ServiceError

MakeNotImplemented builds a goa.ServiceError from an error.

func MakeRateLimit

func MakeRateLimit(err error) *goa.ServiceError

MakeRateLimit builds a goa.ServiceError from an error.

func NewOrdersEndpoint

func NewOrdersEndpoint(s Service) goa.Endpoint

NewOrdersEndpoint returns an endpoint function that calls the method "orders" of service "DerivativesAPI".

func NewPostOrderEndpoint

func NewPostOrderEndpoint(s Service) goa.Endpoint

NewPostOrderEndpoint returns an endpoint function that calls the method "postOrder" of service "DerivativesAPI".

Types

type Client

type Client struct {
	OrdersEndpoint    goa.Endpoint
	PostOrderEndpoint goa.Endpoint
}

Client is the "DerivativesAPI" service client.

func NewClient

func NewClient(orders, postOrder goa.Endpoint) *Client

NewClient initializes a "DerivativesAPI" service client given the endpoints.

func (*Client) Orders

func (c *Client) Orders(ctx context.Context, p *OrdersPayload) (res *OrdersResult, err error)

Orders calls the "orders" endpoint of the "DerivativesAPI" service.

func (*Client) PostOrder

func (c *Client) PostOrder(ctx context.Context, p *PostOrderPayload) (res *PostOrderResult, err error)

PostOrder calls the "postOrder" endpoint of the "DerivativesAPI" service.

type DerivativeOrder

type DerivativeOrder struct {
	// Specify chain ID.
	ChainID int64
	// Futures contract address?
	ExchangeAddress string
	// Address that created the order.
	MakerAddress string
	// Empty.
	TakerAddress string
	// Empty.
	FeeRecipientAddress string
	// Empty.
	SenderAddress string
	// The price of 1 contract denominated in base currency.
	MakerAssetAmount string
	// The quantity of contracts the maker seeks to obtain.
	TakerAssetAmount string
	// Empty
	MakerFee string
	// Empty.
	TakerFee string
	// Timestamp in seconds at which order expires.
	ExpirationTimeSeconds string
	// Arbitrary number to facilitate uniqueness of the order's hash.
	Salt string
	// The marketID of the market for the position if the order is LONG, empty
	// otherwise.  Right padded with 0's.
	MakerAssetData string
	TakerAssetData string
	// Empty.
	MakerFeeAssetData string
	// Empty.
	TakerFeeAssetData string
	// Order signature.
	Signature string
}

A valid signed derivative order based on the schema.

type DerivativeOrderRecord

type DerivativeOrderRecord struct {
	// Derivative Order item.
	DerivativeOrder *DerivativeOrder
	// Additional meta data.
	MetaData map[string]string
}

type Endpoints

type Endpoints struct {
	Orders    goa.Endpoint
	PostOrder goa.Endpoint
}

Endpoints wraps the "DerivativesAPI" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "DerivativesAPI" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "DerivativesAPI" service endpoints.

type OrdersPayload

type OrdersPayload struct {
	// Specify page to return. Page numbering should be 1-indexed, not 0-indexed.
	Page int
	// Limit the amount of items returned per page.  If a query provides an
	// unreasonable perPage value, the API will return a validation error.
	PerPage int
	// ABIv2 encoded data marketID
	TakerAssetData *string
}

OrdersPayload is the payload type of the DerivativesAPI service orders method.

type OrdersResult

type OrdersResult struct {
	// The maximum number of requests you're permitted to make per hour.
	RLimitLimit *int
	// The number of requests remaining in the current rate limit window.
	RLimitRemaining *int
	// The time at which the current rate limit window resets in UTC epoch seconds.
	RLimitReset *int
	// Total records found in collection.
	Total int
	// The page number, starts from 1.
	Page int
	// Records limit per each page.
	PerPage int
	// Derivative orders.
	Records []*DerivativeOrderRecord
}

OrdersResult is the result type of the DerivativesAPI service orders method.

type PostOrderPayload

type PostOrderPayload struct {
	// Specify chain ID.
	ChainID int64
	// Futures contract address?
	ExchangeAddress string
	// Address that created the order.
	MakerAddress string
	// Empty.
	TakerAddress string
	// Empty.
	FeeRecipientAddress string
	// Empty.
	SenderAddress string
	// The price of 1 contract denominated in base currency.
	MakerAssetAmount string
	// The quantity of contracts the maker seeks to obtain.
	TakerAssetAmount string
	// Empty
	MakerFee string
	// Empty.
	TakerFee string
	// Timestamp in seconds at which order expires.
	ExpirationTimeSeconds string
	// Arbitrary number to facilitate uniqueness of the order's hash.
	Salt string
	// The marketID of the market for the position if the order is LONG, empty
	// otherwise.  Right padded with 0's.
	MakerAssetData string
	TakerAssetData string
	// Empty.
	MakerFeeAssetData string
	// Empty.
	TakerFeeAssetData string
	// Order signature.
	Signature string
}

PostOrderPayload is the payload type of the DerivativesAPI service postOrder method.

type PostOrderResult

type PostOrderResult struct {
	// The maximum number of requests you're permitted to make per hour.
	RLimitLimit *int
	// The number of requests remaining in the current rate limit window.
	RLimitRemaining *int
	// The time at which the current rate limit window resets in UTC epoch seconds.
	RLimitReset *int
}

PostOrderResult is the result type of the DerivativesAPI service postOrder method.

type SDAValidationError

type SDAValidationError struct {
	// Validation error code
	Code int
	// Validation error reason description
	Reason string
	// Field name
	Field *string
}

Order validation error explained

func (*SDAValidationError) Error

func (e *SDAValidationError) Error() string

Error returns an error description.

func (*SDAValidationError) ErrorName

func (e *SDAValidationError) ErrorName() string

ErrorName returns "SDAValidationError".

type SDAValidationErrorResponse

type SDAValidationErrorResponse struct {
	// General error code
	Code int
	// Error reason description
	Reason string
	// A list of explained validation errors.
	ValidationErrors []*SDAValidationError
}

Error and description for bad requests.

func (*SDAValidationErrorResponse) Error

Error returns an error description.

func (*SDAValidationErrorResponse) ErrorName

func (e *SDAValidationErrorResponse) ErrorName() string

ErrorName returns "SDAValidationErrorResponse".

type Service

type Service interface {
	// Retrieves a list of orders given query parameters.
	Orders(context.Context, *OrdersPayload) (res *OrdersResult, err error)
	// Submit a signed derivative order to the relayer.
	PostOrder(context.Context, *PostOrderPayload) (res *PostOrderResult, err error)
}

DerivativesAPI implements Injective Standard Derivatives API v0.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL