Code Monkey home page Code Monkey logo

gateapi-csharp's People

Contributors

bfday avatar revilwang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gateapi-csharp's Issues

Selling using Gate.io (C#)

I'm trying to sell coins to USDT when my software decides it's a good time to do so, so basically an instant sale.

I thought the best route to go would be by using a SpotPriceTriggerOrder()

My code is the following:

            var tickers = await apiInstance.ListTickersAsync(currencyPair);

            var lastPrice = Convert.ToDouble(tickers[0].Last);
            var lpLower = lastPrice * 0.99;
            var lpHigher = lastPrice * 1.01;
            var coinVol = await apiInstance.ListSpotAccountsAsync(currency);


            var spotPriceT = new SpotPriceTrigger(lpHigher.ToString(), SpotPriceTrigger.RuleEnum.GreaterThanOrEqualTo, 1440);

            var spotPricePut = new SpotPricePutOrder("limit", SpotPricePutOrder.SideEnum.Sell, lpLower.ToString(), coinVol[0].Available.ToString(), SpotPricePutOrder.AccountEnum.Normal, SpotPricePutOrder.TimeInForceEnum.Ioc);

       
            var spotPriceTriggeredOrder = new SpotPriceTriggeredOrder(spotPriceT, spotPricePut, currencyPair); // SpotPriceTriggeredOrder | 

            
             TriggerOrderResponse result = await apiInstance.CreateSpotPriceTriggeredOrderAsync(spotPriceTriggeredOrder);

Which does work via the API, but nothing sells as you can see here: https://screenrec.com/share/xlcfqS8nrj

For more insight, this is what SpotPriceTriggerOrder equals when I run my code:

{class SpotPriceTriggeredOrder {
  Trigger: class SpotPriceTrigger {
  Price: 4442.5961
  Rule: GreaterThanOrEqualTo
  Expiration: 1440
}

  Put: class SpotPricePutOrder {
  Type: limit
  Side: Sell
  Price: 4354.6239
  Amount: 0.000086
  Account: Normal
  TimeInForce: Ioc
}

  Id: 0
  User: 0
  Market: ETH_USDT
  Ctime: 0
  Ftime: 0
  FiredOrderId: 0
  Status: 
  Reason: 
}
}

I'm trying to sell 1% below the last sale, and the trigger should be working. What am I doing wrong?

How to open spot in C#

I trying to make basic program that can open and close spots via API, I currently using your C# sample code, but I can't make it to work.
I downloaded the project, but there demo files weren't inside so I make new files for them, but now I get many errors in the RunConfig and SpotDemo files. Am I doing something wrong, aren't this files supposed to be inside the project?

Error calling List OrderBook: The SSL connection could not be established, see inner exception.

From time to time I receive this error Message:

The SSL connection could not be established, see inner exception.
Error calling List OrderBook: The SSL connection could not be established, see inner exception.

Line causing the error:

OrderBook requestResult = API._spotApi.ListOrderBook(currencyPair.UnderscoredString, orderDepthAggreation, depthLimit, returnOrderbookId);

whats causing the error or how to mitigate it?

Withdraw assets to new wallet address

Hello everyone,

I am trying to send assets (eg. USDT) from gate.io to binance.

From the side of gate.io, I have never sent USDT to binance before. So the withdrawal address is new and of course not whitelisted in gate.io.

The function for withdraw is:

Public Async Function WithdrawAsync(ByVal coin As String, ByVal qnty As Decimal, ByVal destinationWalletAddress As String, ByVal network As String) As Task(Of LedgerRecord)

Dim culture As CultureInfo
culture = CultureInfo.CreateSpecificCulture("en-US")

Dim w As New LedgerRecord(qnty.ToString("G", CultureInfo.InvariantCulture), coin, destinationWalletAddress, "", network)
Console.WriteLine(w.ToJson())

Return Await withdrawalApi.WithdrawAsync(w)

End Function

The ledger record is (binance USDT wallet address under TRON network):
{ "amount": "50.2", "currency": "USDT", "address": "TE7fxqLHp1UvnGtc5w3wTHWPEqpuHsp5zQ", "memo": "", "chain": "TRX" }

Every time, the response has this exception (Io.Gate.GateApi.Client.GateApiException):
Message: {"message":"Error: only used addresses or verified addresses are allowed for api withdrawal","label":"INVALID_PARAM_VALUE"}

Using NuGet version 4.22.2
So, is there any way to by pass this error and withdraw assets to new (never used before) wallet address?
Unfortunately, after chatting with gate.io support, the functionality of address whitelisting is not implemented yet.
Is there any issue with my code, or I missing something?

Thank you in advance,
Kostas

Update dependencies to uniform the code base and fix security vulnerabilities

Version 4.40.0.

<ItemGroup>
    <PackageReference Include="JsonSubTypes" Version="1.5.2" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
    <PackageReference Include="RestSharp" Version="106.10.1" />
    <PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
</ItemGroup>

Newtonsoft.Json prior to version 13.0.1 is vulnerable to Insecure Defaults due to improper handling of expressions with high nesting level that lead to StackOverFlow exception or high CPU and RAM usage. Exploiting this vulnerability results in Denial Of Service (DoS).
GHSA-5crp-9r3c-p9vr

RestSharp < 106.11.8-alpha.0.13 uses a regular expression which is vulnerable to Regular Expression Denial of Service (ReDoS) when converting strings into DateTimes
GHSA-9pq7-rcxv-47vq

Auto borrow amount exceeds max borrowable error

I have around 100 USDT balance on Spot, on Warehouse (that's most probably isolated margin) pair AGLD/USDT
Leverage is 3x on Gate.io interface and I'm trying to create order for smth like 280-290$ so it's according to course around 80 AGLD. On the interface of Gate.io it's not a problem and I'm able to create such trade, but not via next code, not able to do it even for 60 AGLD:

`using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace GateApiDemo
{
public class MarginDemo
{
public GateApiException returnException;

    public void Run()
    {
        const string currencyPair = "AGLD_USDT";
        string currency = currencyPair.Split('_')[1];

        Configuration config = new Configuration
        {
            BasePath = "https://api.gateio.ws/api/v4",
            ApiV4Key = "key1",
            ApiV4Secret = "key2",
        };


        //Wallet api for transfers between accounts and for total balance
        var walletApi = new WalletApi(config);

        SpotApi spotApi = new SpotApi(config);
        MarginApi marginApi = new MarginApi(config);


        List<Ticker> tickers = spotApi.ListTickers(currencyPair);
        Debug.Assert(tickers.Count == 1);
        string lastPrice = tickers[0].Last;
        Debug.Assert(lastPrice != null);
        Console.WriteLine("currency pair {0} last price: {1}", currencyPair, lastPrice);

        List<MarginCurrencyPair> pairs = marginApi.ListMarginCurrencyPairs();
        MarginCurrencyPair pair = pairs.Find(p => currencyPair.Equals(p.Id));
        decimal loanAmount = pair.MinQuoteAmount == null ? 0 : Convert.ToDecimal(pair.MinQuoteAmount);
        if (pair.MinBaseAmount != null)
        {
            decimal minLoanAmount = Convert.ToDecimal(pair.MinBaseAmount) * Convert.ToDecimal(lastPrice);
            if (loanAmount.CompareTo(minLoanAmount) < 0)
            {
                loanAmount = minLoanAmount;
            }
        }
        Console.WriteLine("minimum loan amount in currency pair {0}: {1} {2}", currencyPair, loanAmount, currency);



        Order order = new Order(currencyPair: currencyPair, amount: "60", price: lastPrice)
        {
            Account = Order.AccountEnum.Margin,
            AutoBorrow = true,
            Side = Order.SideEnum.Buy,
        };

        try
        {
            Order createdOrder = spotApi.CreateOrder(order);
            Console.WriteLine("order created with id {0}, status {1}", createdOrder.Id, createdOrder.Status);
        }
        catch (GateApiException e)
        {
            Console.Error.WriteLine("failed to create margin order: {0}", e);
        }
     
    }
}

}`

That's the error:

image

Why it doesn't allow to use Autoborrow normally ?

How I can use Nuget package to get account balance?

Hello:
I just create V4 API keys for my Gate.IO account, and I want to use Nuget package: Io.Gate.GateApi version 4.26.0 to get my account balance.
But I can’t find any code example. I am using C# on Windows 10.
Please show me some code example on how to use V4 API keys to sign HTTP request and get my account balance.
Thanks,

How to implement WebSocket in C# Application

Hello everyone, can someone explain to me how to implement WebSocket in C#? I found an example for python:

For example, if current unix time in milliseconds is 1583131539528, your APIv4 key is key, secret is secret, the signature should be generated as (in Python code) hmac.new('secret', '1583131539528', hashlib.sha512).hexdigest(), and the result is 54613ee7f4236bf61bfaed71f10bc0cb8b24805c45822652f850812c9a43b2422cf84609197ccf5db7adaf5c6af5d143cf04646c2640ad89a7c89670b403b671 . Send request body to server.sign like:

But how can I implement this in C#? Any ideas?

Error in ApiClient.cs line 127 , on etf_pre_timestamp is null

json:
{"currency_pair":"MKR_USDT","last":"2255","lowest_ask":"2263.71","highest_bid":"2244.4","change_percentage":"-11.66","base_volume":"130.233640705","quote_volume":"301239.0357505955","high_24h":"2577.25","low_24h":"2019.52","etf_net_value":null,"etf_pre_net_value":null,"etf_pre_timestamp":null,"etf_leverage":null}

error msg
Io.Gate.GateApi.Client.ApiException:“Error converting value {null} to type 'System.Int64'. Path '[0].etf_pre_timestamp', line 1, position 294.”

ListOrders and ListMyTrades variable currencyPair not optional with status "finished"

    /// <summary>
    /// List personal trading history Spot and margin trades are queried by default. If cross margin trades are needed, &#x60;account&#x60; must be set to &#x60;cross_margin&#x60;  You can also set &#x60;from&#x60; and(or) &#x60;to&#x60; to query by time range Time range parameters are handled as order finish time.
    /// </summary>
    /// <exception cref="Io.Gate.GateApi.Client.ApiException">Thrown when fails to make API call</exception>
    /// <param name="currencyPair">Retrieve results with specified currency pair. **It is required for open orders, but optional for finished ones.**</param>
    /// <param name="limit">Maximum number of records to be returned in a single list (optional, default to 100)</param>
    /// <param name="page">Page number (optional, default to 1)</param>
    /// <param name="orderId">Filter trades with specified order ID. &#x60;currency_pair&#x60; is also required if this field is present (optional)</param>
    /// <param name="account">Specify operation account. Default to spot and margin account if not specified. Set to &#x60;cross_margin&#x60; to operate against margin account (optional)</param>
    /// <param name="from">Start timestamp of the query (optional)</param>
    /// <param name="to">Time range ending, default to current time (optional)</param>
    /// <returns>ApiResponse of List&lt;Trade&gt;</returns>
    public ApiResponse<List<Trade>> ListMyTradesWithHttpInfo (string currencyPair, int? limit = default(int?), int? page = default(int?), string orderId = default(string), string account = default(string), long? from = default(long?), long? to = default(long?))
    {
        // verify the required parameter 'currencyPair' is set
        **if (currencyPair == null)
            throw new ApiException(400, "Missing required parameter 'currencyPair' when calling SpotApi->ListMyTrades");**

Can't close futures trade with CancelFuturesOrders or with CancelFuturesOrder

Trying to close with each of methods but for some reason it doesn't work. CancelFuturesOrder code is next:

`using System;
using System.Timers;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace GateApiDemo
{
public class FuturesDemo
{
public GateApiException returnException;

    public void Run()
    {

        const string settle = "usdt";
        const string contract = "MATIC_USDT";

        Configuration config = new Configuration
        {
            BasePath = "https://api.gateio.ws/api/v4",
            ApiV4Key = "key1",
            ApiV4Secret = "key2",
        };

        //New futures api
        FuturesApi futuresApi = new FuturesApi(config);

        //Wallet api for transfers between accounts and for total balance
        var apiInstance = new WalletApi(config);
        var currency = "USDT";  // string | Currency unit used to calculate the balance amount. BTC, CNY, USD and USDT are allowed. USDT is the default. (optional)  (default to "USDT")

        //Get account total balance
        var result = new TotalBalance();
        try
        {
            // Retrieve user's total balances
            result = apiInstance.GetTotalBalance(currency);
            Console.WriteLine(result);
        }
        catch (GateApiException e)
        {
            Debug.Print("Exception when calling WalletApi.GetTotalBalance: " + e.Message);
            Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
            Debug.Print("Status Code: " + e.ErrorCode);
            Debug.Print(e.StackTrace);
        }

        //Get contract info
        Contract futuresContract = new Contract();
        try
        {
            futuresContract = futuresApi.GetFuturesContract(settle, contract);
        }
        catch (GateApiException e)
        {
            returnException = e;
            return;
        }

        //Get lot size according to total balance and contract
        var totalBalanceLotSize = Convert.ToDecimal(result.Total.Amount) / (Convert.ToDecimal(futuresContract.LastPrice) * Convert.ToDecimal(futuresContract.QuantoMultiplier));
        
        //Set lot size according to leverage and total balance
        var leverage = 1;
        var leveragedLotSize = totalBalanceLotSize * leverage;

        //Create futures order
        FuturesOrder futuresOrder = new FuturesOrder(contract)
        {
            Size = (long)leveragedLotSize,
            Price = "0",
            Tif = FuturesOrder.TifEnum.Ioc,
        };

        FuturesOrder orderResponse;
        string orderResponseStr = "0";
        long orderId = 0;
        try
        {
            orderResponse = futuresApi.CreateFuturesOrder(settle, futuresOrder);
            orderResponseStr = orderResponse.Status.ToString();
            orderId = orderResponse.Id;
        }
        catch (GateApiException e)
        {
            returnException = e;
        }


        if (orderResponseStr == "Finished")
        {
            FuturesOrder order = futuresApi.GetFuturesOrder(settle, orderId.ToString());
            Console.WriteLine(order);
            //var stopwatch = Stopwatch.StartNew();
            //System.Threading.Thread.SpinWait(100 * 100);
            Console.WriteLine("test");
            futuresApi.CancelFuturesOrder(settle, order.Id.ToString());
            //futuresApi.CancelFuturesOrder(settle, Convert.ToString(orderId));
        }
        
    }
}

}`

That's what I get in console (here is XRP but doesn't matter):
image

And then this exception:

Io.Gate.GateApi.Client.GateApiException
HResult=0x80131500
Source=Io.Gate.GateApi
StackTrace:
at Io.Gate.GateApi.Api.FuturesApi.CancelFuturesOrderWithHttpInfo(String settle, String orderId)
at Io.Gate.GateApi.Api.FuturesApi.CancelFuturesOrder(String settle, String orderId)
at GateApiDemo.FuturesDemo.Run() in C:\Users\root\source\repos\NewListings\FuturesDemo.cs:line 109
at GateApiDemo.Program.Main(String[] args) in C:\Users\root\source\repos\NewListings\Program.cs:line 17

That's details, according to it for some reason api can't find order with such number:

image

order id looks to be correct, it's probably bug or idk what. How to solve this ?

Exceptions

今天下午开始,很多functions都会传回下面这个exception:

Io.Gate.GateApi.Client.ApiException: 'Error calling GetPosition: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Io.Gate.GateApi.Model.Position' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.'

之前跑得好好,请问是啥问题啊?

NuGet

Could you add this to NuGet please

How to count $$ value of minimum order size

Didn't find the way on how I can count real $$ Value of minimum order size or unit size. I need it to set futures contract in $$ according to balance I have. For example for BTC futuresContract.OrderSizeMin gives 1 but how much is this 1 ? Is that 1$ or it's 10$ or which value is this ? And how I can set up order size according to $$ value ? So let's say my $$ balance of account is 500$ and I want to set up futures order for 5000$. How can I do this precisely not knowing what's the min unit size while setting order size ?

I got "REPEAT_REQUEST" label error when I execute my third SpotPriceTriggerOrder

I have an issue. I would like to create 3 trigger orders for buying and I am creating and executing this order async in a loop.

My aim is that I want to sell my coins in a certain percentage in a certain point. For example:
I want to sell 40% of my amounts when the price is %4 increased
sell 35% when the price 6% increased
and sell the rest (25%) when the price 8% increased. That means I give different take profits (TP1, TP2, TP3)

and here is my sample code

var profits= new List()
{
singlePrice * 1.04, //4% increased
singlePrice * 1.06, //6% increased
singlePrice * 1.08 // 8% increased
};

var coinAmounts = new List()
{
totalAmount0.40, // 40% of total amount
totalAmount
0.35, // 35% of total amount
totalAmount*0.25, // 25% of total amount
};
for (int i = 0; i < profits.Count; i++)
{
var sellPrice = profits[i];
var amount = coinAmounts[i];
var triggerOrder = createSpotPriceTriggeredOrder(symbol, sellPrice, amount);
var triggerOrderResult = await _spotApi.CreateSpotPriceTriggeredOrderAsync(triggerOrder);
triggerOrderResonses.Add(triggerOrderResult);
Thread.Sleep(500);
}

createSpotPriceTriggeredOrder method returns a SpotPriceTriggeredOrder instance and I give completly different parameters for the price and the amount ( as you see in my first paragraph).
here is the excepion that I get in the last item of the loop (third one)

{"message":"repeat request","label":"REPEAT_REQUEST"}

Shortly, I can create 2 sell orders but I cannot create last one and I got an exception.

In the API documentation, I did not see such a "label" definition

I use V4 API

PS: I also added a Thread Sleep, because I thought that maybe the process is so fast however 500 ms sleep did not help me

GateApiException status is always 0

Status is not used for GateApiException.

try
{
    var exception = JsonConvert.DeserializeObject<GateApiException>(response.RawContent);
    if (!string.IsNullOrWhiteSpace(exception.ErrorLabel))
    {
        return exception;
    }
}
catch (Exception)
{
    // fallthrough
}
return new ApiException(status,
    string.Format("Error calling {0}: {1}", methodName, response.RawContent),
    response.RawContent);

walletApi.GetTradeFee does not include GT Fees

I have an issue with WalletApi.GetFees(CurrencyPair):

The request executes fine. Fees are returned but GT Trading fee is 0.
My request:

TradeFee result = API._walletApi.GetTradeFee(null);

result:
image

GT discount also seems to be false.
I have tried enabling gt trading on the gate.io account / fees section but it did not replicate in the API. Is there a time/synchronisation off set or do I have to set "gt trading fees" manually somewhere in the API?

Creation of spot price triggered orders fails due to go marshalling

Using SpotApi.CreateSpotPriceTriggeredOrderAsync:

var spotPriceTriggeredOrder = new SpotPriceTriggeredOrder(new SpotPriceTrigger(
        gateIoTradeValues.PriceString,
        triggerRule,
        _optionsMonitor.CurrentValue.TriggeredOrderExpirationSeconds),
    new SpotPricePutOrder(side: SpotPricePutOrder.SideEnum.Sell,
        amount: gateIoTradeValues.AmountString,
        price: gateIoTradeValues.PriceString,
        account: SpotPricePutOrder.AccountEnum.Normal),
    ToCurrencyPairString(buyOrder.ExchangeRate.AssetTokenPair));
await spotApi.CreateSpotPriceTriggeredOrderAsync(spotPriceTriggeredOrder)
    .ConfigureAwait(false);

spotPriceTriggeredOrder.ToJson() looks like the following:

{
  "trigger": {
    "rule": "<=",
    "price": "0.236640",
    "expiration": 604800
  },
  "put": {
    "side": "sell",
    "account": "normal",
    "time_in_force": null,
    "type": "limit",
    "price": "0.236640",
    "amount": "6.85"
  },
  "id": 0,
  "user": 0,
  "market": "DOGE_USDT",
  "ctime": 0.0,
  "ftime": 0.0,
  "fired_order_id": 0,
  "status": null,
  "reason": null
}

Looks like your Go backend isn't expecting to receive floats for ctime:

Io.Gate.GateApi.Client.GateApiException: {"message":"invalid json json: cannot unmarshal number 0.0 into Go struct field TouchOrderV4.ctime of type int64","label":"INVALID_REQUEST_BODY"}
   at Io.Gate.GateApi.Api.SpotApi.CreateSpotPriceTriggeredOrderAsyncWithHttpInfo(SpotPriceTriggeredOrder spotPriceTriggeredOrder)
   at Io.Gate.GateApi.Api.SpotApi.CreateSpotPriceTriggeredOrderAsync(SpotPriceTriggeredOrder spotPriceTriggeredOrder)

Official Nuget Package

Hi, I couldn't find the official Nuget package address in the documentation and this allows scammers to publish their own package. Is the following address the official address?

https://www.nuget.org/packages/Io.Gate.GateApi/4.22.4

Thanks

找不到方法:“Void RestSharp.RestRequest..ctor(RestSharp.Method)

System.MissingMethodException: 找不到方法:“Void RestSharp.RestRequest..ctor(RestSharp.Method)”。
在 Io.Gate.GateApi.Client.ApiClient.NewRequest(HttpMethod method, String path, RequestOptions options, IReadableConfiguration configuration)
在 Io.Gate.GateApi.Client.ApiClient.Get[T](String path, RequestOptions options, IReadableConfiguration configuration)
在 Io.Gate.GateApi.Api.FuturesApi.ListPositionsWithHttpInfo(String settle)
在 Io.Gate.GateApi.Api.FuturesApi.ListPositions(String settle)

更新了版本就变这样了
RestSharp.107.3.0
Io.Gate.GateApi.4.23.4
.NET Framework4.8

How to create market order on margin trading

Is there any way to create market order on margin trading other then randomly increasing price by some % ?
The problem is that this will also reduce available funds for trade and if price increase significantly within short time period trade won't be opened

Error when excute withdraw function

Error message Attempt by method 'Io.Gate.GateApi.Client.ApiClient.Exec(RestSharp.RestRequest, Io.Gate.GateApi.Client.IReadableConfiguration)' to access method 'RestSharp.RestClient.AddHandler(System.Func1<RestSharp.Deserializers.IDeserializer>, System.String[])' failed

Parameters (screenshots)
Screenshot (3)

Please help me
Thank you

CurrencyPair always null

if (string.IsNullOrEmpty(currencyPair))
{
continue;
}
Console.WriteLine(currencyPair);

try
{
var order = new Order
{
CurrencyPair = currencyPair,
Amount = orderBids[0],
Price = orderBids[1],
Side = Order.SideEnum.Sell,
Type = Order.TypeEnum.Limit, // Предполагается, что это лимитный ордер
Iceberg = "0",
TimeInForce = Order.TimeInForceEnum.Gtc,
AutoBorrow = false,
StpAct = Order.StpActEnum.Cn
};

result.Add(await _spotApi.CreateOrderAsync(order));

}
catch (Exception ex)
{
Console.WriteLine("Произошло исключение: " + ex.Message);
Console.WriteLine("StackTrace: " + ex.StackTrace);

if (ex.InnerException != null)
{
    Console.WriteLine("Внутреннее исключение: " + ex.InnerException.Message);
    Console.WriteLine("StackTrace внутреннего исключения: " + ex.InnerException.StackTrace);
}

}
System.InvalidOperationException
HResult=0x80131509
Сообщение = currencyPair is a required property for Order and cannot be null (Parameter 'currencyPair')
Источник = ConsoleApp2
Трассировка стека:
в GateIoApiClient.d__7.MoveNext() в D:\Работа\ConsoleApp2\ConsoleApp2\Program.cs:строка 88
в MyApp.Program.

d__0.MoveNext() в D:\Работа\ConsoleApp2\ConsoleApp2\Program.cs:строка 102

currency Pair всегда null даже после проверки на null, в чем причина?

Missing market order type

Hello, there is no possibility to create the new Order with "Market" order type? In "Order.TypeEnum" I can see just Limit, why? I think API support this functionality or not ? Thank you

找不到方法:“Void RestSharp.RestRequest..ctor(RestSharp.Method)”

`try
{
Configuration _config = new Configuration();
_config.BasePath = "https://api.gateio.ws/api/v4";
_config.SetGateApiV4KeyPair(_apiKey, _secretKey);

            var apiInstance = new SpotApi(_config);
            var result = apiInstance.ListOrderBook(currencyPair);
            return result;
        }
        catch (Exception e)
        {
            return null;
        }`

System.MissingMethodException
HResult=0x80131513
Message=找不到方法:“Void RestSharp.RestRequest..ctor(RestSharp.Method)”。
Source=Io.Gate.GateApi
StackTrace:
at Io.Gate.GateApi.Client.ApiClient.NewRequest(HttpMethod method, String path, RequestOptions options, IReadableConfiguration configuration)
at Io.Gate.GateApi.Client.ApiClient.Get[T](String path, RequestOptions options, IReadableConfiguration configuration)
at Io.Gate.GateApi.Api.SpotApi.ListOrderBookWithHttpInfo(String currencyPair, String interval, Nullable1 limit, Nullable1 withId)
at Io.Gate.GateApi.Api.SpotApi.ListOrderBook(String currencyPair, String interval, Nullable1 limit, Nullable1 withId)
at OrderRobot.Common.CommonHelper.GetBook(String currencyPair) in D:\Work\Core\BrushProject\OrderRobot\Common\CommonHelper.cs:line 33

How do I get all my spot trade history?

By default spot Api provides only last 7 days trade history. I am able to pull last 7 days history without specifying the "from" param.

When I tried to pull last 30 Days trade history, below code is always giving me "SERVER_ERROR"

await apiInstance.ListMyTradesAsync("", from: DateTime.UtcNow.AddDays(-30).Ticks);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.