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: 17 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	ExitService_GetName_FullMethodName    = "/protos.edge.exit.v1.ExitService/GetName"
	ExitService_Enabled_FullMethodName    = "/protos.edge.exit.v1.ExitService/Enabled"
	ExitService_ShouldExit_FullMethodName = "/protos.edge.exit.v1.ExitService/ShouldExit"
)

Variables

View Source
var ExitService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "protos.edge.exit.v1.ExitService",
	HandlerType: (*ExitServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetName",
			Handler:    _ExitService_GetName_Handler,
		},
		{
			MethodName: "Enabled",
			Handler:    _ExitService_Enabled_Handler,
		},
		{
			MethodName: "ShouldExit",
			Handler:    _ExitService_ShouldExit_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "protos/edge/exit/v1/service.proto",
}

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

View Source
var File_protos_edge_exit_v1_service_proto protoreflect.FileDescriptor

Functions

func RegisterExitServiceHandler

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

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

func RegisterExitServiceHandlerClient

func RegisterExitServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ExitServiceClient) error

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

func RegisterExitServiceHandlerFromEndpoint

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

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

func RegisterExitServiceHandlerServer

func RegisterExitServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExitServiceServer) error

RegisterExitServiceHandlerServer registers the http handlers for service ExitService to "mux". UnaryRPC :call ExitServiceServer 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 RegisterExitServiceHandlerFromEndpoint instead.

func RegisterExitServiceServer

func RegisterExitServiceServer(s grpc.ServiceRegistrar, srv ExitServiceServer)

Types

type ExitRequest

type ExitRequest 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
	Position *data.Position        `protobuf:"bytes,2,opt,name=position,proto3" json:"position,omitempty"` // The ID of the position that may be exited
	// contains filtered or unexported fields
}

ExitRequest describes the information that may be used to inform whether or not a position should be exited. No modifications made by the endpoint will be reflected in the data.

func (*ExitRequest) Descriptor deprecated

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

Deprecated: Use ExitRequest.ProtoReflect.Descriptor instead.

func (*ExitRequest) GetContext

func (x *ExitRequest) GetContext() *data.StrategyContext

func (*ExitRequest) GetPosition added in v1.3.0

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

func (*ExitRequest) ProtoMessage

func (*ExitRequest) ProtoMessage()

func (*ExitRequest) ProtoReflect

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

func (*ExitRequest) Reset

func (x *ExitRequest) Reset()

func (*ExitRequest) String

func (x *ExitRequest) String() string

type ExitResult

type ExitResult struct {
	ShouldExit bool               `protobuf:"varint,1,opt,name=should_exit,json=shouldExit,proto3" json:"should_exit,omitempty"` // Whether or not the position should be exited. True, to exit. False to ignore.
	Order      *data.TradeRequest `protobuf:"bytes,2,opt,name=order,proto3" json:"order,omitempty"`                              // The order that represents the position that should be exited. This value will be empty if should_exit is false. Furthermore, the order may be modified by other modules before being submitted.
	// contains filtered or unexported fields
}

ExitResult contains the information that should be returned after an exit decision has been reached and will be used to inform the strategy runner about which action should be taken next.

func (*ExitResult) Descriptor deprecated

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

Deprecated: Use ExitResult.ProtoReflect.Descriptor instead.

func (*ExitResult) GetOrder

func (x *ExitResult) GetOrder() *data.TradeRequest

func (*ExitResult) GetShouldExit

func (x *ExitResult) GetShouldExit() bool

func (*ExitResult) ProtoMessage

func (*ExitResult) ProtoMessage()

func (*ExitResult) ProtoReflect

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

func (*ExitResult) Reset

func (x *ExitResult) Reset()

func (*ExitResult) String

func (x *ExitResult) String() string

type ExitServiceClient

type ExitServiceClient interface {
	// GetName retrieves an identifier associated with the service, allowing the strategy runner to
	// uniquely identify it when multiple filter services are being referenced. It will return a
	// name result showing the address, ID and human-readable name of the filter 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)
	// ShouldExit determines whether or not a position should be exited, using the data contained in
	// the ExitRequest. This endpoint will return an ExitResult, that shows the exit decision and the
	// order that should be submitted to the trade service.
	ShouldExit(ctx context.Context, in *ExitRequest, opts ...grpc.CallOption) (*ExitResult, error)
}

ExitServiceClient is the client API for ExitService 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 ExitServiceServer

type ExitServiceServer interface {
	// GetName retrieves an identifier associated with the service, allowing the strategy runner to
	// uniquely identify it when multiple filter services are being referenced. It will return a
	// name result showing the address, ID and human-readable name of the filter 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)
	// ShouldExit determines whether or not a position should be exited, using the data contained in
	// the ExitRequest. This endpoint will return an ExitResult, that shows the exit decision and the
	// order that should be submitted to the trade service.
	ShouldExit(context.Context, *ExitRequest) (*ExitResult, error)
	// contains filtered or unexported methods
}

ExitServiceServer is the server API for ExitService service. All implementations must embed UnimplementedExitServiceServer for forward compatibility

type UnimplementedExitServiceServer

type UnimplementedExitServiceServer struct {
}

UnimplementedExitServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedExitServiceServer) Enabled added in v1.3.0

func (UnimplementedExitServiceServer) GetName

func (UnimplementedExitServiceServer) ShouldExit

type UnsafeExitServiceServer

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

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

Jump to

Keyboard shortcuts

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