v1

package
v1.3.41 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Unlicense Imports: 18 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	PositionManagementService_GetName_FullMethodName        = "/protos.edge.positions.v1.PositionManagementService/GetName"
	PositionManagementService_Enabled_FullMethodName        = "/protos.edge.positions.v1.PositionManagementService/Enabled"
	PositionManagementService_Calculate_FullMethodName      = "/protos.edge.positions.v1.PositionManagementService/Calculate"
	PositionManagementService_ModifyPosition_FullMethodName = "/protos.edge.positions.v1.PositionManagementService/ModifyPosition"
)

Variables

View Source
var File_protos_edge_positions_v1_service_proto protoreflect.FileDescriptor
View Source
var PositionManagementService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "protos.edge.positions.v1.PositionManagementService",
	HandlerType: (*PositionManagementServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetName",
			Handler:    _PositionManagementService_GetName_Handler,
		},
		{
			MethodName: "Enabled",
			Handler:    _PositionManagementService_Enabled_Handler,
		},
		{
			MethodName: "Calculate",
			Handler:    _PositionManagementService_Calculate_Handler,
		},
		{
			MethodName: "ModifyPosition",
			Handler:    _PositionManagementService_ModifyPosition_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "protos/edge/positions/v1/service.proto",
}

PositionManagementService_ServiceDesc is the grpc.ServiceDesc for PositionManagementService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterPositionManagementServiceHandler

func RegisterPositionManagementServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterPositionManagementServiceHandler registers the http handlers for service PositionManagementService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterPositionManagementServiceHandlerClient

func RegisterPositionManagementServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PositionManagementServiceClient) error

RegisterPositionManagementServiceHandlerClient registers the http handlers for service PositionManagementService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PositionManagementServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PositionManagementServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "PositionManagementServiceClient" to call the correct interceptors.

func RegisterPositionManagementServiceHandlerFromEndpoint

func RegisterPositionManagementServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterPositionManagementServiceHandlerFromEndpoint is same as RegisterPositionManagementServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterPositionManagementServiceHandlerServer

func RegisterPositionManagementServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PositionManagementServiceServer) error

RegisterPositionManagementServiceHandlerServer registers the http handlers for service PositionManagementService to "mux". UnaryRPC :call PositionManagementServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterPositionManagementServiceHandlerFromEndpoint instead.

func RegisterPositionManagementServiceServer

func RegisterPositionManagementServiceServer(s grpc.ServiceRegistrar, srv PositionManagementServiceServer)

Types

type PositionCalculationRequest

type PositionCalculationRequest struct {
	Context *data.StrategyContext `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` // The strategy context that contains information associated with the currently-running strategy
	// contains filtered or unexported fields
}

PositionCalculationRequest contains the data necessary to calculate the values that should represent a shared state between the positions that may be modified. No modifications made by the endpoint will be reflected in the data.

func (*PositionCalculationRequest) Descriptor deprecated

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

Deprecated: Use PositionCalculationRequest.ProtoReflect.Descriptor instead.

func (*PositionCalculationRequest) GetContext

func (*PositionCalculationRequest) ProtoMessage

func (*PositionCalculationRequest) ProtoMessage()

func (*PositionCalculationRequest) ProtoReflect

func (*PositionCalculationRequest) Reset

func (x *PositionCalculationRequest) Reset()

func (*PositionCalculationRequest) String

func (x *PositionCalculationRequest) String() string

type PositionCalculationResponse

type PositionCalculationResponse struct {
	Results *_struct.Struct `protobuf:"bytes,1,opt,name=results,proto3" json:"results,omitempty"` // The results of the calculation
	// contains filtered or unexported fields
}

PositionCalculationResponse contains the results of the calculation, and will be used to inform the modification of every position.

func (*PositionCalculationResponse) Descriptor deprecated

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

Deprecated: Use PositionCalculationResponse.ProtoReflect.Descriptor instead.

func (*PositionCalculationResponse) GetResults

func (x *PositionCalculationResponse) GetResults() *_struct.Struct

func (*PositionCalculationResponse) ProtoMessage

func (*PositionCalculationResponse) ProtoMessage()

func (*PositionCalculationResponse) ProtoReflect

func (*PositionCalculationResponse) Reset

func (x *PositionCalculationResponse) Reset()

func (*PositionCalculationResponse) String

func (x *PositionCalculationResponse) String() string

type PositionManagementServiceClient

type PositionManagementServiceClient interface {
	// GetName retrieves an identifier associated with the service, allowing the strategy runner to
	// uniquely identify it when multiple position services are being referenced. It will return a
	// name result showing the address, ID and human-readable name of the position service that processed
	// the original request.
	GetName(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*data.NameResult, error)
	// Enabled determines whether or not the service is enabled, allowing the strategy runner to skip
	// exit rules for all the positions at a given time.
	Enabled(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*data.EnabledResult, error)
	// Calculate is used to do apriori calculations common to management of all positions for this particular
	// point in time. This function relies on the data contained in the PositionCalculationRequest object to
	// inform the calculation and the results are returned in the PositionCalculationResponse object.
	Calculate(ctx context.Context, in *PositionCalculationRequest, opts ...grpc.CallOption) (*PositionCalculationResponse, error)
	// ModifyPosition takes an existing position and modifies it. Note that this function is not inteded to
	// close an existing position or modify the volume of an existing position, but is rather intended to modify
	// secondary fields on the position, such as stop-loss, take-profit or associated limits. This is done by
	// taking the position, calculated fields and context from the PositionModificationRequest object, taking the
	// necessary modifications, and setting the associated TradeRequest on the PositionModificationResponse response.
	ModifyPosition(ctx context.Context, in *PositionModificationRequest, opts ...grpc.CallOption) (*PositionModificationResponse, error)
}

PositionManagementServiceClient is the client API for PositionManagementService 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.

type PositionManagementServiceServer

type PositionManagementServiceServer interface {
	// GetName retrieves an identifier associated with the service, allowing the strategy runner to
	// uniquely identify it when multiple position services are being referenced. It will return a
	// name result showing the address, ID and human-readable name of the position service that processed
	// the original request.
	GetName(context.Context, *empty.Empty) (*data.NameResult, error)
	// Enabled determines whether or not the service is enabled, allowing the strategy runner to skip
	// exit rules for all the positions at a given time.
	Enabled(context.Context, *empty.Empty) (*data.EnabledResult, error)
	// Calculate is used to do apriori calculations common to management of all positions for this particular
	// point in time. This function relies on the data contained in the PositionCalculationRequest object to
	// inform the calculation and the results are returned in the PositionCalculationResponse object.
	Calculate(context.Context, *PositionCalculationRequest) (*PositionCalculationResponse, error)
	// ModifyPosition takes an existing position and modifies it. Note that this function is not inteded to
	// close an existing position or modify the volume of an existing position, but is rather intended to modify
	// secondary fields on the position, such as stop-loss, take-profit or associated limits. This is done by
	// taking the position, calculated fields and context from the PositionModificationRequest object, taking the
	// necessary modifications, and setting the associated TradeRequest on the PositionModificationResponse response.
	ModifyPosition(context.Context, *PositionModificationRequest) (*PositionModificationResponse, error)
	// contains filtered or unexported methods
}

PositionManagementServiceServer is the server API for PositionManagementService service. All implementations must embed UnimplementedPositionManagementServiceServer for forward compatibility

type PositionModificationRequest

type PositionModificationRequest struct {
	Context          *data.StrategyContext `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"`                                           // The strategy context that contains information associated with the currently-running strategy
	CalculatedFields *_struct.Struct       `protobuf:"bytes,2,opt,name=calculated_fields,json=calculatedFields,proto3" json:"calculated_fields,omitempty"` // The results of the calculation step, to be submitted along with this position
	Position         *data.Position        `protobuf:"bytes,3,opt,name=position,proto3" json:"position,omitempty"`                                         // The ID of the position that may be exited
	// contains filtered or unexported fields
}

PositionModificationRequest contains the information that may be used to modify a position contained in the request. No modifications made by the endpoint will be reflected in the data.

func (*PositionModificationRequest) Descriptor deprecated

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

Deprecated: Use PositionModificationRequest.ProtoReflect.Descriptor instead.

func (*PositionModificationRequest) GetCalculatedFields

func (x *PositionModificationRequest) GetCalculatedFields() *_struct.Struct

func (*PositionModificationRequest) GetContext

func (*PositionModificationRequest) GetPosition

func (x *PositionModificationRequest) GetPosition() *data.Position

func (*PositionModificationRequest) ProtoMessage

func (*PositionModificationRequest) ProtoMessage()

func (*PositionModificationRequest) ProtoReflect

func (*PositionModificationRequest) Reset

func (x *PositionModificationRequest) Reset()

func (*PositionModificationRequest) String

func (x *PositionModificationRequest) String() string

type PositionModificationResponse

type PositionModificationResponse struct {
	ShouldModify bool               `protobuf:"varint,1,opt,name=should_modify,json=shouldModify,proto3" json:"should_modify,omitempty"` // Whether or not the position should be modified or cancelled
	Order        *data.TradeRequest `protobuf:"bytes,2,opt,name=order,proto3" json:"order,omitempty"`                                    // The trade request that represents the position that should be modified or cancelled.
	// contains filtered or unexported fields
}

PositionModificationResponse describes the information that will be returned from the service. This will contain the trade request that will be submitted to the trade system on behalf of the strategy.

func (*PositionModificationResponse) Descriptor deprecated

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

Deprecated: Use PositionModificationResponse.ProtoReflect.Descriptor instead.

func (*PositionModificationResponse) GetOrder

func (*PositionModificationResponse) GetShouldModify

func (x *PositionModificationResponse) GetShouldModify() bool

func (*PositionModificationResponse) ProtoMessage

func (*PositionModificationResponse) ProtoMessage()

func (*PositionModificationResponse) ProtoReflect

func (*PositionModificationResponse) Reset

func (x *PositionModificationResponse) Reset()

func (*PositionModificationResponse) String

type UnimplementedPositionManagementServiceServer

type UnimplementedPositionManagementServiceServer struct {
}

UnimplementedPositionManagementServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedPositionManagementServiceServer) Calculate

func (UnimplementedPositionManagementServiceServer) Enabled

func (UnimplementedPositionManagementServiceServer) GetName

func (UnimplementedPositionManagementServiceServer) ModifyPosition

type UnsafePositionManagementServiceServer

type UnsafePositionManagementServiceServer interface {
	// contains filtered or unexported methods
}

UnsafePositionManagementServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PositionManagementServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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