mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 07:26:45 +00:00
gRPC/Engine/Exchanges: Implement direct getwithdrawalshistory method (#600)
* GetClosedOrder implemented for Kraken and Binance, fixed Binance MARKET order creaton, added rate, fee and cost fileds on SubmitOrder responce * return Trades on Binance SubmitOrder, new validation methods on Binance and kraken GetClosedOrderInfo * removed the Binance extra method GetClosedOrder * func description corrected * removed price, fee and cost from SimulateOrder response, as we get all necessary info in response to calculate them on client side * GetClosedOrder implementation moved to GetOrderInfo * changed GetOrderInfo params * removed Canceled order.Type used for Kraken * update QueryOrder in gctscript * add missed params to QueryOrder validator (gctscript) * fixed testing issues * GetClosedOrder implemented for Kraken and Binance, fixed Binance MARKET order creaton, added rate, fee and cost fileds on SubmitOrder responce * return Trades on Binance SubmitOrder, new validation methods on Binance and kraken GetClosedOrderInfo * removed the Binance extra method GetClosedOrder * func description corrected * removed price, fee and cost from SimulateOrder response, as we get all necessary info in response to calculate them on client side * GetClosedOrder implementation moved to GetOrderInfo * changed GetOrderInfo params * removed Canceled order.Type used for Kraken * update QueryOrder in gctscript * add missed params to QueryOrder validator (gctscript) * fixed testing issues * pull previous changes * linter issues fix * updated query_order exmple in gctscript, fixed params check * removed orderPair unnecessary conversion * added wsCancelAllOrders, fixed bugs * fixed Kraken wsAddOrder method * cleanup * CancelBatchOrders implementation * changed CancelBatchOrders signature * fixed tests and wrappers * btcmarkets_test fix * cleanup * cleanup * changed CancelBatchOrders signature * fmt * Update configtest.json * Update configtest.json * rollback configtest * refactored Kraken wsHandleData to allow tests * removed unnecessary error test in TestWsAddOrderJSON * dependencies updates * fixed issue with PortfolioSleepDelay set on startup * add GetWithdrawalsHistory method to exchanges interface * param name changes * add extra params for Binance WithdrawStatus method * add Binance TestWithdrawHistory * linter errors fix Co-authored-by: Vazha Bezhanishvili <vazha.bezhanishvili@elegro.eu>
This commit is contained in:
@@ -34,6 +34,7 @@ type GoCryptoTraderClient interface {
|
||||
GetOrderbook(ctx context.Context, in *GetOrderbookRequest, opts ...grpc.CallOption) (*OrderbookResponse, error)
|
||||
GetOrderbooks(ctx context.Context, in *GetOrderbooksRequest, opts ...grpc.CallOption) (*GetOrderbooksResponse, error)
|
||||
GetAccountInfo(ctx context.Context, in *GetAccountInfoRequest, opts ...grpc.CallOption) (*GetAccountInfoResponse, error)
|
||||
UpdateAccountInfo(ctx context.Context, in *GetAccountInfoRequest, opts ...grpc.CallOption) (*GetAccountInfoResponse, error)
|
||||
GetAccountInfoStream(ctx context.Context, in *GetAccountInfoRequest, opts ...grpc.CallOption) (GoCryptoTrader_GetAccountInfoStreamClient, error)
|
||||
GetConfig(ctx context.Context, in *GetConfigRequest, opts ...grpc.CallOption) (*GetConfigResponse, error)
|
||||
GetPortfolio(ctx context.Context, in *GetPortfolioRequest, opts ...grpc.CallOption) (*GetPortfolioResponse, error)
|
||||
@@ -95,7 +96,6 @@ type GoCryptoTraderClient interface {
|
||||
FindMissingSavedCandleIntervals(ctx context.Context, in *FindMissingCandlePeriodsRequest, opts ...grpc.CallOption) (*FindMissingIntervalsResponse, error)
|
||||
FindMissingSavedTradeIntervals(ctx context.Context, in *FindMissingTradePeriodsRequest, opts ...grpc.CallOption) (*FindMissingIntervalsResponse, error)
|
||||
SetExchangeTradeProcessing(ctx context.Context, in *SetExchangeTradeProcessingRequest, opts ...grpc.CallOption) (*GenericResponse, error)
|
||||
UpdateAccountInfo(ctx context.Context, in *GetAccountInfoRequest, opts ...grpc.CallOption) (*GetAccountInfoResponse, error)
|
||||
}
|
||||
|
||||
type goCryptoTraderClient struct {
|
||||
@@ -259,6 +259,15 @@ func (c *goCryptoTraderClient) GetAccountInfo(ctx context.Context, in *GetAccoun
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *goCryptoTraderClient) UpdateAccountInfo(ctx context.Context, in *GetAccountInfoRequest, opts ...grpc.CallOption) (*GetAccountInfoResponse, error) {
|
||||
out := new(GetAccountInfoResponse)
|
||||
err := c.cc.Invoke(ctx, "/gctrpc.GoCryptoTrader/UpdateAccountInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *goCryptoTraderClient) GetAccountInfoStream(ctx context.Context, in *GetAccountInfoRequest, opts ...grpc.CallOption) (GoCryptoTrader_GetAccountInfoStreamClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &_GoCryptoTrader_serviceDesc.Streams[0], "/gctrpc.GoCryptoTrader/GetAccountInfoStream", opts...)
|
||||
if err != nil {
|
||||
@@ -946,15 +955,6 @@ func (c *goCryptoTraderClient) SetExchangeTradeProcessing(ctx context.Context, i
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *goCryptoTraderClient) UpdateAccountInfo(ctx context.Context, in *GetAccountInfoRequest, opts ...grpc.CallOption) (*GetAccountInfoResponse, error) {
|
||||
out := new(GetAccountInfoResponse)
|
||||
err := c.cc.Invoke(ctx, "/gctrpc.GoCryptoTrader/UpdateAccountInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// GoCryptoTraderServer is the server API for GoCryptoTrader service.
|
||||
// All implementations must embed UnimplementedGoCryptoTraderServer
|
||||
// for forward compatibility
|
||||
@@ -976,6 +976,7 @@ type GoCryptoTraderServer interface {
|
||||
GetOrderbook(context.Context, *GetOrderbookRequest) (*OrderbookResponse, error)
|
||||
GetOrderbooks(context.Context, *GetOrderbooksRequest) (*GetOrderbooksResponse, error)
|
||||
GetAccountInfo(context.Context, *GetAccountInfoRequest) (*GetAccountInfoResponse, error)
|
||||
UpdateAccountInfo(context.Context, *GetAccountInfoRequest) (*GetAccountInfoResponse, error)
|
||||
GetAccountInfoStream(*GetAccountInfoRequest, GoCryptoTrader_GetAccountInfoStreamServer) error
|
||||
GetConfig(context.Context, *GetConfigRequest) (*GetConfigResponse, error)
|
||||
GetPortfolio(context.Context, *GetPortfolioRequest) (*GetPortfolioResponse, error)
|
||||
@@ -1037,7 +1038,6 @@ type GoCryptoTraderServer interface {
|
||||
FindMissingSavedCandleIntervals(context.Context, *FindMissingCandlePeriodsRequest) (*FindMissingIntervalsResponse, error)
|
||||
FindMissingSavedTradeIntervals(context.Context, *FindMissingTradePeriodsRequest) (*FindMissingIntervalsResponse, error)
|
||||
SetExchangeTradeProcessing(context.Context, *SetExchangeTradeProcessingRequest) (*GenericResponse, error)
|
||||
UpdateAccountInfo(context.Context, *GetAccountInfoRequest) (*GetAccountInfoResponse, error)
|
||||
mustEmbedUnimplementedGoCryptoTraderServer()
|
||||
}
|
||||
|
||||
@@ -1096,6 +1096,9 @@ func (UnimplementedGoCryptoTraderServer) GetOrderbooks(context.Context, *GetOrde
|
||||
func (UnimplementedGoCryptoTraderServer) GetAccountInfo(context.Context, *GetAccountInfoRequest) (*GetAccountInfoResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetAccountInfo not implemented")
|
||||
}
|
||||
func (UnimplementedGoCryptoTraderServer) UpdateAccountInfo(context.Context, *GetAccountInfoRequest) (*GetAccountInfoResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateAccountInfo not implemented")
|
||||
}
|
||||
func (UnimplementedGoCryptoTraderServer) GetAccountInfoStream(*GetAccountInfoRequest, GoCryptoTrader_GetAccountInfoStreamServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method GetAccountInfoStream not implemented")
|
||||
}
|
||||
@@ -1279,9 +1282,6 @@ func (UnimplementedGoCryptoTraderServer) FindMissingSavedTradeIntervals(context.
|
||||
func (UnimplementedGoCryptoTraderServer) SetExchangeTradeProcessing(context.Context, *SetExchangeTradeProcessingRequest) (*GenericResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SetExchangeTradeProcessing not implemented")
|
||||
}
|
||||
func (UnimplementedGoCryptoTraderServer) UpdateAccountInfo(context.Context, *GetAccountInfoRequest) (*GetAccountInfoResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateAccountInfo not implemented")
|
||||
}
|
||||
func (UnimplementedGoCryptoTraderServer) mustEmbedUnimplementedGoCryptoTraderServer() {}
|
||||
|
||||
// UnsafeGoCryptoTraderServer may be embedded to opt out of forward compatibility for this service.
|
||||
@@ -1601,6 +1601,24 @@ func _GoCryptoTrader_GetAccountInfo_Handler(srv interface{}, ctx context.Context
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _GoCryptoTrader_UpdateAccountInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetAccountInfoRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(GoCryptoTraderServer).UpdateAccountInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/gctrpc.GoCryptoTrader/UpdateAccountInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(GoCryptoTraderServer).UpdateAccountInfo(ctx, req.(*GetAccountInfoRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _GoCryptoTrader_GetAccountInfoStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(GetAccountInfoRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
@@ -2717,24 +2735,6 @@ func _GoCryptoTrader_SetExchangeTradeProcessing_Handler(srv interface{}, ctx con
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _GoCryptoTrader_UpdateAccountInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetAccountInfoRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(GoCryptoTraderServer).UpdateAccountInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/gctrpc.GoCryptoTrader/UpdateAccountInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(GoCryptoTraderServer).UpdateAccountInfo(ctx, req.(*GetAccountInfoRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _GoCryptoTrader_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "gctrpc.GoCryptoTrader",
|
||||
HandlerType: (*GoCryptoTraderServer)(nil),
|
||||
@@ -2807,6 +2807,10 @@ var _GoCryptoTrader_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "GetAccountInfo",
|
||||
Handler: _GoCryptoTrader_GetAccountInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateAccountInfo",
|
||||
Handler: _GoCryptoTrader_UpdateAccountInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetConfig",
|
||||
Handler: _GoCryptoTrader_GetConfig_Handler,
|
||||
@@ -3027,10 +3031,6 @@ var _GoCryptoTrader_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "SetExchangeTradeProcessing",
|
||||
Handler: _GoCryptoTrader_SetExchangeTradeProcessing_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateAccountInfo",
|
||||
Handler: _GoCryptoTrader_UpdateAccountInfo_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user