trade

package
v0.0.0-...-ac3f6eb Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TradeType_name = map[int32]string{
		0: "BUY",
		1: "SELL",
	}
	TradeType_value = map[string]int32{
		"BUY":  0,
		"SELL": 1,
	}
)

Enum value maps for TradeType.

View Source
var File_trade_proto protoreflect.FileDescriptor

Functions

func RegisterTradeServer

func RegisterTradeServer(s *grpc.Server, srv TradeServer)

Types

type BalancesReply

type BalancesReply struct {
	Balances []*types.BalanceWithFee `protobuf:"bytes,1,rep,name=balances,proto3" json:"balances,omitempty"`
	// contains filtered or unexported fields
}

func (*BalancesReply) Descriptor deprecated

func (*BalancesReply) Descriptor() ([]byte, []int)

Deprecated: Use BalancesReply.ProtoReflect.Descriptor instead.

func (*BalancesReply) GetBalances

func (x *BalancesReply) GetBalances() []*types.BalanceWithFee

func (*BalancesReply) ProtoMessage

func (*BalancesReply) ProtoMessage()

func (*BalancesReply) ProtoReflect

func (x *BalancesReply) ProtoReflect() protoreflect.Message

func (*BalancesReply) Reset

func (x *BalancesReply) Reset()

func (*BalancesReply) String

func (x *BalancesReply) String() string

type BalancesRequest

type BalancesRequest struct {
	Market *types.Market `protobuf:"bytes,1,opt,name=market,proto3" json:"market,omitempty"`
	// contains filtered or unexported fields
}

func (*BalancesRequest) Descriptor deprecated

func (*BalancesRequest) Descriptor() ([]byte, []int)

Deprecated: Use BalancesRequest.ProtoReflect.Descriptor instead.

func (*BalancesRequest) GetMarket

func (x *BalancesRequest) GetMarket() *types.Market

func (*BalancesRequest) ProtoMessage

func (*BalancesRequest) ProtoMessage()

func (*BalancesRequest) ProtoReflect

func (x *BalancesRequest) ProtoReflect() protoreflect.Message

func (*BalancesRequest) Reset

func (x *BalancesRequest) Reset()

func (*BalancesRequest) String

func (x *BalancesRequest) String() string

type CompleteTradeReply

type CompleteTradeReply struct {
	Txid     string         `protobuf:"bytes,1,opt,name=txid,proto3" json:"txid,omitempty"`
	SwapFail *swap.SwapFail `protobuf:"bytes,2,opt,name=swap_fail,json=swapFail,proto3" json:"swap_fail,omitempty"`
	// contains filtered or unexported fields
}

func (*CompleteTradeReply) Descriptor deprecated

func (*CompleteTradeReply) Descriptor() ([]byte, []int)

Deprecated: Use CompleteTradeReply.ProtoReflect.Descriptor instead.

func (*CompleteTradeReply) GetSwapFail

func (x *CompleteTradeReply) GetSwapFail() *swap.SwapFail

func (*CompleteTradeReply) GetTxid

func (x *CompleteTradeReply) GetTxid() string

func (*CompleteTradeReply) ProtoMessage

func (*CompleteTradeReply) ProtoMessage()

func (*CompleteTradeReply) ProtoReflect

func (x *CompleteTradeReply) ProtoReflect() protoreflect.Message

func (*CompleteTradeReply) Reset

func (x *CompleteTradeReply) Reset()

func (*CompleteTradeReply) String

func (x *CompleteTradeReply) String() string

type CompleteTradeRequest

type CompleteTradeRequest struct {
	SwapComplete *swap.SwapComplete `protobuf:"bytes,1,opt,name=swap_complete,json=swapComplete,proto3" json:"swap_complete,omitempty"`
	SwapFail     *swap.SwapFail     `protobuf:"bytes,2,opt,name=swap_fail,json=swapFail,proto3" json:"swap_fail,omitempty"`
	// contains filtered or unexported fields
}

func (*CompleteTradeRequest) Descriptor deprecated

func (*CompleteTradeRequest) Descriptor() ([]byte, []int)

Deprecated: Use CompleteTradeRequest.ProtoReflect.Descriptor instead.

func (*CompleteTradeRequest) GetSwapComplete

func (x *CompleteTradeRequest) GetSwapComplete() *swap.SwapComplete

func (*CompleteTradeRequest) GetSwapFail

func (x *CompleteTradeRequest) GetSwapFail() *swap.SwapFail

func (*CompleteTradeRequest) ProtoMessage

func (*CompleteTradeRequest) ProtoMessage()

func (*CompleteTradeRequest) ProtoReflect

func (x *CompleteTradeRequest) ProtoReflect() protoreflect.Message

func (*CompleteTradeRequest) Reset

func (x *CompleteTradeRequest) Reset()

func (*CompleteTradeRequest) String

func (x *CompleteTradeRequest) String() string

type MarketPriceReply

type MarketPriceReply struct {
	Prices []*types.PriceWithFee `protobuf:"bytes,1,rep,name=prices,proto3" json:"prices,omitempty"`
	// contains filtered or unexported fields
}

func (*MarketPriceReply) Descriptor deprecated

func (*MarketPriceReply) Descriptor() ([]byte, []int)

Deprecated: Use MarketPriceReply.ProtoReflect.Descriptor instead.

func (*MarketPriceReply) GetPrices

func (x *MarketPriceReply) GetPrices() []*types.PriceWithFee

func (*MarketPriceReply) ProtoMessage

func (*MarketPriceReply) ProtoMessage()

func (*MarketPriceReply) ProtoReflect

func (x *MarketPriceReply) ProtoReflect() protoreflect.Message

func (*MarketPriceReply) Reset

func (x *MarketPriceReply) Reset()

func (*MarketPriceReply) String

func (x *MarketPriceReply) String() string

type MarketPriceRequest

type MarketPriceRequest struct {
	Market *types.Market `protobuf:"bytes,1,opt,name=market,proto3" json:"market,omitempty"`
	Type   TradeType     `protobuf:"varint,2,opt,name=type,proto3,enum=TradeType" json:"type,omitempty"`
	Amount uint64        `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"`
	Asset  string        `protobuf:"bytes,4,opt,name=asset,proto3" json:"asset,omitempty"`
	// contains filtered or unexported fields
}

func (*MarketPriceRequest) Descriptor deprecated

func (*MarketPriceRequest) Descriptor() ([]byte, []int)

Deprecated: Use MarketPriceRequest.ProtoReflect.Descriptor instead.

func (*MarketPriceRequest) GetAmount

func (x *MarketPriceRequest) GetAmount() uint64

func (*MarketPriceRequest) GetAsset

func (x *MarketPriceRequest) GetAsset() string

func (*MarketPriceRequest) GetMarket

func (x *MarketPriceRequest) GetMarket() *types.Market

func (*MarketPriceRequest) GetType

func (x *MarketPriceRequest) GetType() TradeType

func (*MarketPriceRequest) ProtoMessage

func (*MarketPriceRequest) ProtoMessage()

func (*MarketPriceRequest) ProtoReflect

func (x *MarketPriceRequest) ProtoReflect() protoreflect.Message

func (*MarketPriceRequest) Reset

func (x *MarketPriceRequest) Reset()

func (*MarketPriceRequest) String

func (x *MarketPriceRequest) String() string

type MarketsReply

type MarketsReply struct {
	Markets []*types.MarketWithFee `protobuf:"bytes,1,rep,name=markets,proto3" json:"markets,omitempty"`
	// contains filtered or unexported fields
}

func (*MarketsReply) Descriptor deprecated

func (*MarketsReply) Descriptor() ([]byte, []int)

Deprecated: Use MarketsReply.ProtoReflect.Descriptor instead.

func (*MarketsReply) GetMarkets

func (x *MarketsReply) GetMarkets() []*types.MarketWithFee

func (*MarketsReply) ProtoMessage

func (*MarketsReply) ProtoMessage()

func (*MarketsReply) ProtoReflect

func (x *MarketsReply) ProtoReflect() protoreflect.Message

func (*MarketsReply) Reset

func (x *MarketsReply) Reset()

func (*MarketsReply) String

func (x *MarketsReply) String() string

type MarketsRequest

type MarketsRequest struct {
	// contains filtered or unexported fields
}

BOTD#4 Service's messages

func (*MarketsRequest) Descriptor deprecated

func (*MarketsRequest) Descriptor() ([]byte, []int)

Deprecated: Use MarketsRequest.ProtoReflect.Descriptor instead.

func (*MarketsRequest) ProtoMessage

func (*MarketsRequest) ProtoMessage()

func (*MarketsRequest) ProtoReflect

func (x *MarketsRequest) ProtoReflect() protoreflect.Message

func (*MarketsRequest) Reset

func (x *MarketsRequest) Reset()

func (*MarketsRequest) String

func (x *MarketsRequest) String() string

type ProposeTradeReply

type ProposeTradeReply struct {
	SwapAccept     *swap.SwapAccept `protobuf:"bytes,1,opt,name=swap_accept,json=swapAccept,proto3" json:"swap_accept,omitempty"`
	SwapFail       *swap.SwapFail   `protobuf:"bytes,2,opt,name=swap_fail,json=swapFail,proto3" json:"swap_fail,omitempty"`
	ExpiryTimeUnix uint64           `protobuf:"varint,3,opt,name=expiry_time_unix,json=expiryTimeUnix,proto3" json:"expiry_time_unix,omitempty"`
	// contains filtered or unexported fields
}

func (*ProposeTradeReply) Descriptor deprecated

func (*ProposeTradeReply) Descriptor() ([]byte, []int)

Deprecated: Use ProposeTradeReply.ProtoReflect.Descriptor instead.

func (*ProposeTradeReply) GetExpiryTimeUnix

func (x *ProposeTradeReply) GetExpiryTimeUnix() uint64

func (*ProposeTradeReply) GetSwapAccept

func (x *ProposeTradeReply) GetSwapAccept() *swap.SwapAccept

func (*ProposeTradeReply) GetSwapFail

func (x *ProposeTradeReply) GetSwapFail() *swap.SwapFail

func (*ProposeTradeReply) ProtoMessage

func (*ProposeTradeReply) ProtoMessage()

func (*ProposeTradeReply) ProtoReflect

func (x *ProposeTradeReply) ProtoReflect() protoreflect.Message

func (*ProposeTradeReply) Reset

func (x *ProposeTradeReply) Reset()

func (*ProposeTradeReply) String

func (x *ProposeTradeReply) String() string

type ProposeTradeRequest

type ProposeTradeRequest struct {
	Market      *types.Market     `protobuf:"bytes,1,opt,name=market,proto3" json:"market,omitempty"`
	Type        TradeType         `protobuf:"varint,2,opt,name=type,proto3,enum=TradeType" json:"type,omitempty"`
	SwapRequest *swap.SwapRequest `protobuf:"bytes,3,opt,name=swap_request,json=swapRequest,proto3" json:"swap_request,omitempty"`
	// contains filtered or unexported fields
}

func (*ProposeTradeRequest) Descriptor deprecated

func (*ProposeTradeRequest) Descriptor() ([]byte, []int)

Deprecated: Use ProposeTradeRequest.ProtoReflect.Descriptor instead.

func (*ProposeTradeRequest) GetMarket

func (x *ProposeTradeRequest) GetMarket() *types.Market

func (*ProposeTradeRequest) GetSwapRequest

func (x *ProposeTradeRequest) GetSwapRequest() *swap.SwapRequest

func (*ProposeTradeRequest) GetType

func (x *ProposeTradeRequest) GetType() TradeType

func (*ProposeTradeRequest) ProtoMessage

func (*ProposeTradeRequest) ProtoMessage()

func (*ProposeTradeRequest) ProtoReflect

func (x *ProposeTradeRequest) ProtoReflect() protoreflect.Message

func (*ProposeTradeRequest) Reset

func (x *ProposeTradeRequest) Reset()

func (*ProposeTradeRequest) String

func (x *ProposeTradeRequest) String() string

type TradeClient

type TradeClient interface {
	// Markets: List all the markets open for trading.
	Markets(ctx context.Context, in *MarketsRequest, opts ...grpc.CallOption) (*MarketsReply, error)
	// Balances: Gets the balances of the two current reserves in the given
	// market.
	Balances(ctx context.Context, in *BalancesRequest, opts ...grpc.CallOption) (*BalancesReply, error)
	// MarketPrice: Gets the current market price. In case of AMM startegy, the
	// trade type and
	// the amount of asset to be either sent or received.
	//
	// BUY = quote asset as input
	// SELL = base asset as input
	//
	// If the type of the trade is BUY it means the base asset will be received by
	// the trader.
	//
	// If the type of the trade is SELL it means the base asset will be sent by
	// the trader.
	MarketPrice(ctx context.Context, in *MarketPriceRequest, opts ...grpc.CallOption) (*MarketPriceReply, error)
	// DEPRECATED TradePropose: Sends a swap request message containing a partial signed
	// transaction.
	//
	// BUY = quote asset as input
	// SELL = base asset as input
	//
	//
	// If the type of the trade is BUY it means the base asset will be received by
	// the trader.
	//
	// If the type of the trade is SELL it means the base asset will be sent by
	// the trader.
	TradePropose(ctx context.Context, in *TradeProposeRequest, opts ...grpc.CallOption) (Trade_TradeProposeClient, error)
	// Unary RPC for TradePropose.
	ProposeTrade(ctx context.Context, in *ProposeTradeRequest, opts ...grpc.CallOption) (*ProposeTradeReply, error)
	// DEPRECATED TradeComplete: Sends the trader's counter-signed transaction to the
	// provider. If something wrong, a swap fail message is sent. It returns the
	// transaction hash of the broadcasted transaction.
	TradeComplete(ctx context.Context, in *TradeCompleteRequest, opts ...grpc.CallOption) (Trade_TradeCompleteClient, error)
	// Unary RPC for TradeComplete.
	CompleteTrade(ctx context.Context, in *CompleteTradeRequest, opts ...grpc.CallOption) (*CompleteTradeReply, error)
}

TradeClient is the client API for Trade service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewTradeClient

func NewTradeClient(cc grpc.ClientConnInterface) TradeClient

type TradeCompleteReply

type TradeCompleteReply struct {
	Txid     string         `protobuf:"bytes,1,opt,name=txid,proto3" json:"txid,omitempty"`
	SwapFail *swap.SwapFail `protobuf:"bytes,2,opt,name=swap_fail,json=swapFail,proto3" json:"swap_fail,omitempty"`
	// contains filtered or unexported fields
}

func (*TradeCompleteReply) Descriptor deprecated

func (*TradeCompleteReply) Descriptor() ([]byte, []int)

Deprecated: Use TradeCompleteReply.ProtoReflect.Descriptor instead.

func (*TradeCompleteReply) GetSwapFail

func (x *TradeCompleteReply) GetSwapFail() *swap.SwapFail

func (*TradeCompleteReply) GetTxid

func (x *TradeCompleteReply) GetTxid() string

func (*TradeCompleteReply) ProtoMessage

func (*TradeCompleteReply) ProtoMessage()

func (*TradeCompleteReply) ProtoReflect

func (x *TradeCompleteReply) ProtoReflect() protoreflect.Message

func (*TradeCompleteReply) Reset

func (x *TradeCompleteReply) Reset()

func (*TradeCompleteReply) String

func (x *TradeCompleteReply) String() string

type TradeCompleteRequest

type TradeCompleteRequest struct {
	SwapComplete *swap.SwapComplete `protobuf:"bytes,1,opt,name=swap_complete,json=swapComplete,proto3" json:"swap_complete,omitempty"`
	SwapFail     *swap.SwapFail     `protobuf:"bytes,2,opt,name=swap_fail,json=swapFail,proto3" json:"swap_fail,omitempty"`
	// contains filtered or unexported fields
}

func (*TradeCompleteRequest) Descriptor deprecated

func (*TradeCompleteRequest) Descriptor() ([]byte, []int)

Deprecated: Use TradeCompleteRequest.ProtoReflect.Descriptor instead.

func (*TradeCompleteRequest) GetSwapComplete

func (x *TradeCompleteRequest) GetSwapComplete() *swap.SwapComplete

func (*TradeCompleteRequest) GetSwapFail

func (x *TradeCompleteRequest) GetSwapFail() *swap.SwapFail

func (*TradeCompleteRequest) ProtoMessage

func (*TradeCompleteRequest) ProtoMessage()

func (*TradeCompleteRequest) ProtoReflect

func (x *TradeCompleteRequest) ProtoReflect() protoreflect.Message

func (*TradeCompleteRequest) Reset

func (x *TradeCompleteRequest) Reset()

func (*TradeCompleteRequest) String

func (x *TradeCompleteRequest) String() string

type TradeProposeReply

type TradeProposeReply struct {
	SwapAccept     *swap.SwapAccept `protobuf:"bytes,1,opt,name=swap_accept,json=swapAccept,proto3" json:"swap_accept,omitempty"`
	SwapFail       *swap.SwapFail   `protobuf:"bytes,2,opt,name=swap_fail,json=swapFail,proto3" json:"swap_fail,omitempty"`
	ExpiryTimeUnix uint64           `protobuf:"varint,3,opt,name=expiry_time_unix,json=expiryTimeUnix,proto3" json:"expiry_time_unix,omitempty"`
	// contains filtered or unexported fields
}

func (*TradeProposeReply) Descriptor deprecated

func (*TradeProposeReply) Descriptor() ([]byte, []int)

Deprecated: Use TradeProposeReply.ProtoReflect.Descriptor instead.

func (*TradeProposeReply) GetExpiryTimeUnix

func (x *TradeProposeReply) GetExpiryTimeUnix() uint64

func (*TradeProposeReply) GetSwapAccept

func (x *TradeProposeReply) GetSwapAccept() *swap.SwapAccept

func (*TradeProposeReply) GetSwapFail

func (x *TradeProposeReply) GetSwapFail() *swap.SwapFail

func (*TradeProposeReply) ProtoMessage

func (*TradeProposeReply) ProtoMessage()

func (*TradeProposeReply) ProtoReflect

func (x *TradeProposeReply) ProtoReflect() protoreflect.Message

func (*TradeProposeReply) Reset

func (x *TradeProposeReply) Reset()

func (*TradeProposeReply) String

func (x *TradeProposeReply) String() string

type TradeProposeRequest

type TradeProposeRequest struct {
	Market      *types.Market     `protobuf:"bytes,1,opt,name=market,proto3" json:"market,omitempty"`
	Type        TradeType         `protobuf:"varint,2,opt,name=type,proto3,enum=TradeType" json:"type,omitempty"`
	SwapRequest *swap.SwapRequest `protobuf:"bytes,3,opt,name=swap_request,json=swapRequest,proto3" json:"swap_request,omitempty"`
	// contains filtered or unexported fields
}

func (*TradeProposeRequest) Descriptor deprecated

func (*TradeProposeRequest) Descriptor() ([]byte, []int)

Deprecated: Use TradeProposeRequest.ProtoReflect.Descriptor instead.

func (*TradeProposeRequest) GetMarket

func (x *TradeProposeRequest) GetMarket() *types.Market

func (*TradeProposeRequest) GetSwapRequest

func (x *TradeProposeRequest) GetSwapRequest() *swap.SwapRequest

func (*TradeProposeRequest) GetType

func (x *TradeProposeRequest) GetType() TradeType

func (*TradeProposeRequest) ProtoMessage

func (*TradeProposeRequest) ProtoMessage()

func (*TradeProposeRequest) ProtoReflect

func (x *TradeProposeRequest) ProtoReflect() protoreflect.Message

func (*TradeProposeRequest) Reset

func (x *TradeProposeRequest) Reset()

func (*TradeProposeRequest) String

func (x *TradeProposeRequest) String() string

type TradeServer

type TradeServer interface {
	// Markets: List all the markets open for trading.
	Markets(context.Context, *MarketsRequest) (*MarketsReply, error)
	// Balances: Gets the balances of the two current reserves in the given
	// market.
	Balances(context.Context, *BalancesRequest) (*BalancesReply, error)
	// MarketPrice: Gets the current market price. In case of AMM startegy, the
	// trade type and
	// the amount of asset to be either sent or received.
	//
	// BUY = quote asset as input
	// SELL = base asset as input
	//
	// If the type of the trade is BUY it means the base asset will be received by
	// the trader.
	//
	// If the type of the trade is SELL it means the base asset will be sent by
	// the trader.
	MarketPrice(context.Context, *MarketPriceRequest) (*MarketPriceReply, error)
	// DEPRECATED TradePropose: Sends a swap request message containing a partial signed
	// transaction.
	//
	// BUY = quote asset as input
	// SELL = base asset as input
	//
	//
	// If the type of the trade is BUY it means the base asset will be received by
	// the trader.
	//
	// If the type of the trade is SELL it means the base asset will be sent by
	// the trader.
	TradePropose(*TradeProposeRequest, Trade_TradeProposeServer) error
	// Unary RPC for TradePropose.
	ProposeTrade(context.Context, *ProposeTradeRequest) (*ProposeTradeReply, error)
	// DEPRECATED TradeComplete: Sends the trader's counter-signed transaction to the
	// provider. If something wrong, a swap fail message is sent. It returns the
	// transaction hash of the broadcasted transaction.
	TradeComplete(*TradeCompleteRequest, Trade_TradeCompleteServer) error
	// Unary RPC for TradeComplete.
	CompleteTrade(context.Context, *CompleteTradeRequest) (*CompleteTradeReply, error)
	// contains filtered or unexported methods
}

TradeServer is the server API for Trade service. All implementations must embed UnimplementedTradeServer for forward compatibility

type TradeType

type TradeType int32
const (
	TradeType_BUY  TradeType = 0
	TradeType_SELL TradeType = 1
)

func (TradeType) Descriptor

func (TradeType) Descriptor() protoreflect.EnumDescriptor

func (TradeType) Enum

func (x TradeType) Enum() *TradeType

func (TradeType) EnumDescriptor deprecated

func (TradeType) EnumDescriptor() ([]byte, []int)

Deprecated: Use TradeType.Descriptor instead.

func (TradeType) Number

func (x TradeType) Number() protoreflect.EnumNumber

func (TradeType) String

func (x TradeType) String() string

func (TradeType) Type

type Trade_TradeCompleteClient

type Trade_TradeCompleteClient interface {
	Recv() (*TradeCompleteReply, error)
	grpc.ClientStream
}

type Trade_TradeCompleteServer

type Trade_TradeCompleteServer interface {
	Send(*TradeCompleteReply) error
	grpc.ServerStream
}

type Trade_TradeProposeClient

type Trade_TradeProposeClient interface {
	Recv() (*TradeProposeReply, error)
	grpc.ClientStream
}

type Trade_TradeProposeServer

type Trade_TradeProposeServer interface {
	Send(*TradeProposeReply) error
	grpc.ServerStream
}

type UnimplementedTradeServer

type UnimplementedTradeServer struct {
}

UnimplementedTradeServer must be embedded to have forward compatible implementations.

func (*UnimplementedTradeServer) Balances

func (*UnimplementedTradeServer) CompleteTrade

func (*UnimplementedTradeServer) MarketPrice

func (*UnimplementedTradeServer) Markets

func (*UnimplementedTradeServer) ProposeTrade

func (*UnimplementedTradeServer) TradeComplete

func (*UnimplementedTradeServer) TradePropose

Jump to

Keyboard shortcuts

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