Giter Club home page Giter Club logo

kucoinapi.net's People

Contributors

mscheetz avatar sergeevgregory avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

kucoinapi.net's Issues

{"code":"400005","msg":"Invalid KC-API-SIGN"}

Hi. I have troubles with lib. Pls help) I think i made a stupid mistake. Whats wrong here?

public static string apiKey = "xxx";
public static string apiSecret = "yyy";
public static string apiPassword = "zzz";
static void Main(string[] args) {

 var clientOid = Guid.NewGuid().ToString().Replace("-", "");
 var body = new SortedDictionary <string,  object>();
 body.Add("clientOid", clientOid);
 body.Add("symbol", "BTC-LTC");
 body.Add("price", 0.1);
 body.Add("side", "BUY");
 body.Add("size", 0.6);
 body.Add("type", "LIMIT");

 var timestamp0 = Convert.ToInt64(Regex.Match(new WebClient().DownloadString("https://openapi-v2.kucoin.com/api/v1/timestamp"), "(?<=data\":).+(?=})").Value);

 var headers = GetRequestHeaders(HttpMethod.Post, "https://openapi-v2.kucoin.com/api/v1/orders",
  Convert.ToInt64(timestamp0), body);

 var request = (HttpWebRequest) WebRequest.Create("https://openapi-v2.kucoin.com/api/v1/orders");
 request.ContentType = "application/json";
 request.Method = "POST";

 foreach(KeyValuePair <string, string> entry in headers) {
  request.Headers.Add(entry.Key, entry.Value);
 }
 using(var streamWriter = new StreamWriter(request.GetRequestStream())) {
  string json = JsonConvert.SerializeObject(headers);
  streamWriter.Write(json);
 }

 var response = (HttpWebResponse) request.GetResponse();
 using(var streamReader = new StreamReader(response.GetResponseStream())) {
  var result = streamReader.ReadToEnd();
 }
}

private static Dictionary <string, string> GetRequestHeaders(HttpMethod httpMethod, string endpoint, long timestamp, SortedDictionary <string, object> body = null) {
 var headers = new Dictionary <string, string>();

 headers.Add("KC-API-KEY", apiKey);
 headers.Add("KC-API-SIGN", new Security().GetSignature(httpMethod.ToString(), endpoint, timestamp, apiSecret, body));
 headers.Add("KC-API-TIMESTAMP", timestamp.ToString());
 headers.Add("KC-API-PASSPHRASE", apiPassword);

 return headers;
}

Please, add List dealt orders(merged) ( /v1/order/dealt)

Dear developer,
I need function "List dealt orders(merged)" from kucoin api documentation, but your Lib hasn't it (May be I mistake?). Can you add it? It is important, that symbol field can be empty, in this case all user history returned by server. Hope you will have time to add this functionality to your library. Thx.

GetBalance does not work

Dear Developer,
I tried to use private (trade) Kucoin API, and have trouble.
When I try to get Balances, I got exception in GetApiStream in OnGetBalances:

Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'KuCoinApi.NetCore.Entities.Balance[]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'data.total', line 1, position 99.

Hope you can help. Thx.

Get fills params issue

I tried to get list fills with request parameters:

  • startAt = 1550595600000
  • endAt = 1550768399000

The reponse content is a message "Get List Fills doesn't support get fills in a large timespan (> 24 hours)" with code "400100"

PostTrade doesn't work

Dear Developer, today I tested new version of Package. GetBalance issue was fixed, but PostTrade doesn't work... I attached screen with error. Hope you will fix this issue too. Thx

posttrade

KuCoinApi.Net v2.0 doesn't work with RESTApiAccess v 1.3.0

Dear developer,
today I download from nuget KuCoinApi.Net (0.3.0) and error occurs during debug my app:
MissingMethodException: Method not found: "System.Threading.Tasks.Task1<!!0> RESTApiAccess.Interface.IRESTRepository.GetApiStream(System.String, System.Collections.Generic.Dictionary2<System.String,System.String>)".

I downgraded verison of RESTApiAccess from 1.3.0 to 1.2.1 and app works now. Please, fix this issue.

Get24HrStats does not work

According to the API this should work and it does. The test explorer fails until this edit is made.
///


/// Get 24 hour stats for a trading pair
///

/// Trading pair
/// TradingPairStats object
public async Task Get24HrStats(string pair)
{
var endpoint = $"/api/v1/market/stats?symbol={pair}";

        return await Get<TradingPairStats>(endpoint, false);
    }

C# Console

Hi, i have an issue. I am trying to run the following code on a command promt/console but i keep getting this error
Severity Code Description Project File Line Suppression State
Error CS5001 Program does not contain a static 'Main' method suitable for an entry point KCSBOTBROS C:\Users\ribei\OneDrive\Ambiente de Trabalho\KCSBOTBROS\CSC 1 Active

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading;
using KuCoinApi.Net;

namespace KCSBOTBROS
{
public class Program
{
static async void Main(string[] args)
{
Console.Title = "KCSBotBros";
IKuCoinDotNet kucoin = new KuCoinDotNet("1", "1", "1");
Console.ForegroundColor = ConsoleColor.White;
Console.Write("Input the asset you want to invest with:");
string asset = Console.ReadLine();
Console.Write("Input the amount you want to invest:");
string amount = Console.ReadLine();
Console.Write("Input the desired profit(%):");
string profit = Console.ReadLine();
Console.Write("Input symbol:");
string symbol = Console.ReadLine();
string pair = symbol + "-" + asset;
decimal price;
var market_order = await kucoin.PlaceMarketOrder(pair, KuCoinApi.Net.Entities.Side.BUY, 1);
var orderdetails = await kucoin.GetOrder(market_order);
price = orderdetails.DealFunds / orderdetails.DealSize;
Console.WriteLine("Deal Funds:" + orderdetails.DealFunds + "\n" + "Deal Size:" + orderdetails.DealSize + "\n" + "Deal Price:" + price);
}
}
}

Please, add GetAllTickers

Dear developer,
please, add GetAllTickers function (GET /api/v1/market/allTickers) for v2 branch.

Thank you.

GetFills() request returns no data

I am currently trying to retrieve both historical orders and the newer fills after the 2.0 update. I am running into a bit of trouble with the newer GetFills() method.

On my account, I have trade history data from prior to the update and after. The Historical orders endpoint works fine, but I don't get any data back when calling GetFills(). Here are the trades on my account I am trying to retrieve:
image

Both uses of this endpoint return no data when called:
image

Is it possible that I am missing something when using this endpoint?

Thanks!

C#

Hi, i was wondering if am i able to use this code in a Windows Form Application(.NET Framework)?I am trying to build an application where the user can do everything he would do in the kucoin website/app! I am finding a hard time using the code.

API v 2.0

Dear developer,
kucoin API updated to v2. Old API didn't work. Can you update your library?

Many endpoints/parameters are wrong

Hi,
thx for effort, but I always need to figure out the correct endpoints, because almost none of them works, i.e. /timestamp instead of v1/time, and then fails on getbalance. Has kucoin changed these during their new API development?

Interval Enums do not match lastest API

    public int IntervalToKuCoinInterval(Interval interval)
    {
        switch (interval)
        {
            case Interval.OneM:
                return 0;
            case Interval.ThreeM:
                return 1;
            case Interval.FiveM:
                return 2;
            case Interval.FifteenM:
                return 3;
            case Interval.ThirtyM:
                return 4;
            case Interval.OneH:
                return 5;
            case Interval.TwoH:
                return 6;
            case Interval.FourH:
                return 7;
            case Interval.SixH:
                return 8;
            case Interval.EightH:
                return 9;
            case Interval.TwelveH:
                return 10;
            case Interval.OneD:
                return 11;
            case Interval.OneW:
                return 12;
            default:
                return 0;
        }
    }

Authentication expire time

hi dear
I can not find api credential time out
we must to send apiKey, secret in every request
or
kuCoin has expireTime ?
thanks

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.