Git Product home page Git Product logo

digitalruby / exchangesharp Goto Github PK

View Code? Open in Web Editor NEW
741.0 76.0 375.0 15.71 MB

ExchangeSharp is a powerful, fast and easy to use .NET/C# API for interfacing with many crypto currency exchanges. REST and web sockets are supported.

Home Page: https://www.digitalruby.com

License: MIT License

C# 99.95% Shell 0.05%
cryptocurrency api csharp bitfinex bitstamp gdax poloniex gemini bittrex exchange

exchangesharp's Introduction

Project's logo

Github Sponsorship

NuGet

Overview

ExchangeSharp is a C# framework/lib and console app for trading and communicating with various exchange API end points for cryptocurrency assets. Many exchanges are supported, along with web sockets, withdraws and more!

Feel free to visit the discord channel at https://discord.gg/58ktxXuTVK and chat with other developers.

Features

  • Many exchanges supported with public, private and web socket API
  • Easy to use code and API
  • Optional global market symbol normalization, since each exchange has their own way of doing market symbols
  • Runs anywhere .NET runs. (Windows, Mac, Linux, Containers, Serverless, iOS, Android, etc.)
  • Can be used from many different C# platforms
  • Has a great CLI that enables you to use all features from all exchanges right from your command line.

Exchanges

The following cryptocurrency exchanges are supported:
(Web socket key: T = tickers, R = trades, B = orderbook / delta orderbook, O = private orders, U = user data)

Exchange Name Public REST Private REST Web Socket Notes
ApolloX x x T R B O U
Aquanow wip x
Binance x x T R B O U
Binance Jersey x x T R B O U Ceased operations
Binance.US x x T R B O U
Binance DEX R
Bitbank x x
Bitfinex x x T R O
Bitflyer R
Bithumb x R
BitMEX x x R O
Bitstamp x x R
Bittrex x x T R
BL3P x x R B Trades stream does not send trade's ids.
Bleutrade x x
BtcTurk R
BTSE x x
Bybit x x R Has public method for Websocket Positions
Coinbase (Advanced) x x T R O U
Coincheck R
Coinmate x x
Crypto.com R
Digifinex x x R B
Dydx R
FTX x x T R
FTX.us x x T R
gate.io x x R
Gemini x x T R B
HitBTC x x R
Huobi x x R B
Kraken x x R Dark order symbols not supported
KuCoin x x T R
LBank x x R
Livecoin x x
MEXC x x
NDAX x x T R
OKCoin x x R B
OKEx x x T R B O
Poloniex x x T R B
UPbit R
YoBit x x
ZB.com wip R

The following cryptocurrency services are supported:

  • Cryptowatch (partial)

Exchange constructors are private, to get access to an exchange in code use:

ExchangeAPI.GetExchangeAPIAsync<>().

Installing the CLI

On *nix systems:

  • Run this command curl https://github.com/DigitalRuby/ExchangeSharp/raw/main/install-console.sh | sh

On Windows (or manually):

  • Download the latest binaries for your OS.
  • Unzip it into a folder that is in your environment variable PATH (ctrl + shift + pause|break -> Environment Variables)
  • Use it from your preferred command-line emulator (e.g. Powershell, cmd, etc.)
  • exchange-sharp --help shows all available commands

Notes

ExchangeSharp uses marketSymbol to refer to markets, or pairs of currencies.

Please send pull requests if you have made a change that you feel is worthwhile, want a bug fixed or want a new feature. You can also donate to get new features.

Websockets

If you must use an older Windows (older than win8.1), you'll need to use the Websocket4Net nuget package, and override the web socket implementation by calling

ExchangeSharp.ClientWebSocket.RegisterWebSocketCreator(
    () => new ExchangeSharpConsole.WebSocket4NetClientWebSocket()
);

See WebSocket4NetClientWebSocket.cs for implementation details.

Nuget

dotnet CLI

dotnet add package DigitalRuby.ExchangeSharp --version 1.1.1

Package Manager on VS

PM> Install-Package DigitalRuby.ExchangeSharp -Version 1.1.1

Examples

Creating an order

There's a lot of examples on how to use the API in our console application.
e.g. ExampleOption.cs

Getting ticker info via Web Sockets

public static async Task Main(string[] args)
{
    // create a web socket connection to Binance. Note you can Dispose the socket anytime to shut it down.
    using var api = await ExchangeAPI.GetExchangeAPIAsync<ExchangeBinanceAPI>();
    // the web socket will handle disconnects and attempt to re-connect automatically.
    using var socket = await api.GetTickersWebSocket(tickers =>
    {
        Console.WriteLine("{0} tickers, first: {1}", tickers.Count, tickers.First());
    });

    Console.WriteLine("Press ENTER to shutdown.");
    Console.ReadLine(true);
}

Authentication

Private api calls like placing orders require you to call LoadApiKeys first. You can generate an api keys file by running the bundled console application and choosing the generate key file option.

Logging

ExchangeSharp uses NLog internally currently. To log, use ExchangeSharp.Logger.

Do not use Console.WriteLine to log messages in the lib project.

Provide your own nlog.config or app.config nlog configuration if you want to change logging settings or turn logging off.

Caching

The ExchageAPI class provides a method caching mechanism. Use MethodCachePolicy to put caching behind public methods, or clear to remove caching. Some methods are cached by default. You can set ExchangeAPI.UseDefaultMethodCachePolicy to false to stop all caching as well.

You can also set request cache policy if you want to tweak how the http caching behaves.

How to contribute

Please read the contributing guideline before submitting a pull request.

Consulting

I'm happy to make customizations to the software for you and keep in private repo, email [email protected].

Donations Gratefully Accepted

Believe it or not, donations are quite rare. I've posted publicly the total donation amounts below. If ExchangeSharp has helped you in any way, please consider donating.

Donate with Bitcoin

Donate with Litecoin

Donate with Ethereum

Donate

Donation totals: 0.039 BTC, 10.25 LTC

Thanks for visiting!

Jeff Johnson
[email protected]
http://www.digitalruby.com

exchangesharp's People

Contributors

basman avatar bezysoftware avatar bichuga avatar bz-co avatar ecben avatar edalmasso avatar gajewskiarek avatar jacobjthompson avatar jazzonaut avatar jdx-john avatar jjxtra avatar joemphilips avatar johnnyasantoss avatar kukks avatar lordofdoom avatar mevcj avatar neumediacrypto avatar o-mutt avatar ofekw avatar onurselcuk avatar paradoxforge avatar peixer avatar revetter avatar superhappychris avatar szmcdull avatar tarasmi avatar username77 avatar v36u avatar vslee avatar wukan1986 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  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  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  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  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  avatar  avatar  avatar

exchangesharp's Issues

Code does not build

I have a problem building the code upon checkout.

Details:
I get 52 errors. Mostly basic syntax errors such as undeclared variables. Building in VS 2015 against .NET 4.5 and .NET 4.6.

For example in BaseAPI.cs

protected bool ReadCache(string key, out T value)
{
lock (cache)
{
if (cache.TryGetValue(key, out KeyValuePair<DateTime, object> cacheValue))
{
// if not expired, return
if (cacheValue.Key > DateTime.UtcNow)
{
value = (T)cacheValue.Value;
return true;
}
cache.Remove(key);
}
}
value = default(T);
return false;
}

cacheValue is not defined.

Am I missing something?

Poloniex: How to prevent "Complete: Error" withdrawals

Details:
Through some luck I discovered a coin, ARDR, that requires both an address and a "message" field to deposit to Bittrex, but Poloniex only allows you to provide an address for the withdrawal.

image

I decided to get $5 of ARDR and try to initiate the transfer with both fields via the API. The API accepted it and after processing for a few minutes, the withdrawal changed to status "Complete: Error"

image

The coins never got transferred - no matching transaction ever showed up on the blockchain. However the coins also never got credited back to my account. On reddit, it looks like this is a pretty common problem when people mess up their withdrawal request. Support tickets to poloniex for this type of thing seem to take months to resolve.

The question is, how do we prevent someone from initiating a withdrawal like this and jamming up their coins? As far as I can tell, their API provides no hint to prevent this.

Nonce must be greater than 1521820320325620736. You provided 636574244290423835.

I have a [BUG REPORT]

Details:
` try
{
ExchangeSharp.ExchangePoloniexAPI api = new ExchangeSharp.ExchangePoloniexAPI();

            api.LoadAPIKeysUnsecure("ZZZ", "YYY");

            var results = api.GetAmounts();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }`

Error Logs (if any):
Nonce must be greater than 1521820320325620736. You provided 636574244290423835.

GetHistoricalTrades -> Binance

Binance have API Limit for HistoricalTrades (1 hour)

A workaround could be to use call GetHistoricalTrades sinceDateTime + 1 hour until the current date is reached (not really a great option because we need to call the API 24x/day for historical but works)

GetOpenOrderDetails fails on Bittrex

I have a [BUG REPORT]

Details:
running GetOpenOrderDetails on Bittrex fails with error System.ArgumentException: 'Can not convert Null to Decimal.'

It fails in Parse order on line:
order.AveragePrice = token["PricePerUnit"].ConvertInvariant(token["Price"].ConvertInvariant());

if I dump the Jobject I get this:

{
"success": true,
"message": "",
"result": [
{
"Uuid": null,
"OrderUuid": "6523de7d-e999-4d24-ad70-3adaf2895190",
"Exchange": "BTC-DGB",
"OrderType": "LIMIT_SELL",
"Quantity": 7000.0,
"QuantityRemaining": 7000.0,
"Limit": 5.49E-06,
"CommissionPaid": 0.0,
"Price": 0.0,
"PricePerUnit": null,
"Opened": "2018-02-09T15:00:53.76",
"Closed": null,
"CancelInitiated": false,
"ImmediateOrCancel": false,
"IsConditional": false,
"Condition": "NONE",
"ConditionTarget": null
},
{
"Uuid": null,
"OrderUuid": "b6b68d04-20ff-4d4a-a108-66fd35015a8b",
"Exchange": "BTC-DGB",
"OrderType": "LIMIT_SELL",
"Quantity": 5000.0,
"QuantityRemaining": 5000.0,
"Limit": 4.77E-06,
"CommissionPaid": 0.0,
"Price": 0.0,
"PricePerUnit": null,
"Opened": "2018-02-09T15:01:07.273",
"Closed": null,
"CancelInitiated": false,
"ImmediateOrCancel": false,
"IsConditional": false,
"Condition": "NONE",
"ConditionTarget": null
},
{
"Uuid": null,
"OrderUuid": "e2369e65-46be-4e9b-9812-1c9d659192ac",
"Exchange": "BTC-DGB",
"OrderType": "LIMIT_SELL",
"Quantity": 2000.0,
"QuantityRemaining": 2000.0,
"Limit": 8E-06,
"CommissionPaid": 0.0,
"Price": 0.0,
"PricePerUnit": null,
"Opened": "2018-02-09T15:02:01.777",
"Closed": null,
"CancelInitiated": false,
"ImmediateOrCancel": false,
"IsConditional": false,
"Condition": "NONE",
"ConditionTarget": null
},
{
"Uuid": null,
"OrderUuid": "e6b1525a-126d-44e6-ab97-579a8ff69464",
"Exchange": "BTC-DGB",
"OrderType": "LIMIT_SELL",
"Quantity": 1500.0,
"QuantityRemaining": 1500.0,
"Limit": 1.1E-05,
"CommissionPaid": 0.0,
"Price": 0.0,
"PricePerUnit": null,
"Opened": "2018-02-09T15:02:26.9",
"Closed": null,
"CancelInitiated": false,
"ImmediateOrCancel": false,
"IsConditional": false,
"Condition": "NONE",
"ConditionTarget": null
},
{
"Uuid": null,
"OrderUuid": "2ac91366-16ed-4930-b4f5-b7ff06c64c60",
"Exchange": "BTC-DGB",
"OrderType": "LIMIT_SELL",
"Quantity": 2014.79418184,
"QuantityRemaining": 2014.79418184,
"Limit": 1.9E-05,
"CommissionPaid": 0.0,
"Price": 0.0,
"PricePerUnit": null,
"Opened": "2018-02-09T15:02:40.823",
"Closed": null,
"CancelInitiated": false,
"ImmediateOrCancel": false,
"IsConditional": false,
"Condition": "NONE",
"ConditionTarget": null
}
]
}

PricePerUnit is null, since these are opened orders, so it fails.

Is there a way to do a post-only order?

I will donate to anyone willing to implement and test such a feature with at least polinex.

I have a question/FEATURE REQUEST regarding fees. When I call "PlaceOrder" there are flags that we can set as the OrderType but this is only Market/Limit... I was thinking we can take it to another level for exchanges like GDAX and Poloniex that you can set In the request so you don't pay a taker fee, you are guaranteed to pay the lower maker fee's. Is this available now or a way to implement this?

For example, on Poloniex: A post-only order will only be placed if no portion of it fills immediately; this guarantees you will never pay the taker fee on any part of the order that fills.

Available options for Poloniex:
You may optionally set "fillOrKill", "immediateOrCancel", "postOnly" to 1

Is there plans to implement GetOrderDetails for Poloinex?

I have a FEATURE REQUEST

Details:
When I make an order, and I want to get the details of that order to Poloniex I get a not implemented exception and was hoping to know if this is something that'll be added?

Thanks so much for this project, I just started to play with it and you have done exceptional work.

Yobit integration

Hi Jeff,
do you have any plan to insert yobit exchange into exchangesharp?

thank you

Davide

Gdax not working for sandbox

All my calls return for placeorder and getopenorders do not work for the sandbox. They work with a different api.

'The remote server returned an error: (400) Bad Request.'

using

public string MakeRequest(string url, string baseUrl = null, Dictionary<string, object> payload = null, string method = null)

Not sure if the error is on my side or the api request

Can you confirm that your Gdax methods work with the sandbox?

Thank you. (p.s. great code)

Net Core 2.0 InvalidCastException: Object must implement IConvertible

The following code for KrakenAPI throws error on Net Core 2.0

ExchangeKrakenAPI api = new ExchangeKrakenAPI();
ExchangeTicker ticker = api.GetTicker("USDTZUSD");

System.InvalidCastException: Object must implement IConvertible.
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at ExchangeSharp.CryptoUtility.ConvertInvariant[T](Object obj, T defaultValue)
at ExchangeSharp.ExchangeKrakenAPI.GetTicker(String symbol)

GetCandles within backgroundworker

Hi Jeff,

I have some problem calling GetCandles within a background worker, seems that the function return immediately, I've tryed the GetTickers and everything works fine, could you please help me with this issue?

thx

Davide

Timestamp for this request was 1000ms ahead of the server's time.

I have a question about ExchangeSharp.

Details:
I started using the binance api via ExchangeSharp. Before I got this working I needed to change my date time settings to sync with internet time. This worked after I changed this settings. But I now often still get exceptions when calling the api. What can I do to improve this, because this is very frustratring. My date time settings (in Windows 10) are set to automatic. I've chosen time.windows.com in Internet time settings to sync with.

And thank you for your time and effort you are putting in this project.

Jacob

Error Logs (if any):
ExchangeSharp.APIException: {"code":-1021,"msg":"Timestamp for this request was 1000ms ahead of the server's time."}
bij ExchangeSharp.BaseAPI.MakeRequest(String url, String baseUrl, Dictionary2 payload, String method) in C:\Source\BittrexTrader\ExchangeSharp\API\BaseAPI.cs:regel 176 bij ExchangeSharp.BaseAPI.MakeJsonRequest[T](String url, String baseUrl, Dictionary2 payload, String requestMethod) in C:\Source\BittrexTrader\ExchangeSharp\API\BaseAPI.cs:regel 206
bij ExchangeSharp.ExchangeBinanceAPI.GetAmounts() in C:\Source\BittrexTrader\ExchangeSharp\API\Exchanges\ExchangeBinanceAPI.cs:regel 57
bij BittrexTrader.Algorithm.BittrexTrader.UpdateBalances() in C:\Source\BittrexTrader\BittrexTrader\Algorithm\BittrexTrader.cs:regel 677
bij BittrexTrader.Algorithm.BittrexTrader.GetMarketsAndBalances() in C:\Source\BittrexTrader\BittrexTrader\Algorithm\BittrexTrader.cs:regel 384
bij BittrexTrader.Algorithm.BittrexTrader.Start(Decimal buyPart, Decimal sellPercentageOffset, Decimal buyPercentageOffset, Decimal historyTake

The more information you can provide, the better :)

GetHistoricalTrades callback parameter

The GetHistoricalTrades API is the only function that includes a callback parameter. Is this intentional, or an oversight? The ability to update in a loop should be at the implementation level, not API. Will other public functions support this type of callback in the future (i.e. GetOrderBook, GetOpenOrders, etc.)? If so, a subscription type API might be used for consistency, such as SubscribeOrderBook, SubscribeHistoricalTrades, etc.

PlaceOrder function does not convert price variable to string because of regional settings

ExchangeBitfinexAPI class PlaceOrder function has a number format bug in price variable (probably all exchange PlaceOrder functions)
My operating systems number format is in Turkish format (dot for digit and comma for decimal symbol). So when i try to use PlaceOrder function, the price variable can not be converted to string correctly. I use ToString(CultureInfo.InvariantCulture.NumberFormat) function at the price variable like you do in amount variable when converting to string to avoid of this problem.

Sealed Classes?

The latest update now has all the ExchangeAPI based classes sealed. I've been extending these classes with my own Interface to add functionality needed in my app. They're now broken because I can't derive from them anymore.

Would it be possible to unseal these classes?

I can get around it by creating these extended classes with the ExchangeAPI passed as a parameter if not. At the moment, however, I can't compile.

Bitfinex api is now at version 2.0, CANDLES endpoint can give us OHLC data

Just a stupid question, but the Bitfinex getcandles only returns 120 candles, no matter what start and stop time I place. The v1 api doesn't even do candles, but v2 has the candles endpoint, and an unpublished limit of 1000 (from experimenting).

Bittrex getcandles returns about 1420 with same start and end times.

            int i = 0;
            var dd = apiBitfinex.GetCandles("ETHBTC", 3600, new DateTime(2017, 2, 8), new DateTime(2018, 2, 11));
            foreach(var c in ddf)
            {
                Console.WriteLine(i.ToString() + "  " + c.Timestamp.ToShortDateString() + "  " + c.Timestamp.ToShortTimeString() + "  " + c.ClosePrice.ToString());
                i++;
                Application.DoEvents();
            }

AMAZING job! Thanks for a project in c#. Not many of us out there as everyone seems to love python and java variants.

islandTraderFX

Binance - Timestamp for this request was 1000ms ahead of the server's time.

Bug report: Failure to place order at Binance due to "Timestamp for this request was 1000ms ahead of the server's time." This was working last night. It looks like we have an enormous recvWindow. Any ideas?

Details:
https://api.binance.com/api/v3/account?timestamp=1518390378874&recvWindow=86400000&signature=

2018-02-11 15:05:20,429 [23] WARN  Worker - Exchange-RefreshBalances failed due to exception ExchangeSharp.APIException: {"code":-1021,"msg":"Timestamp for this request was 1000ms ahead of the server's time."}
   at ExchangeSharp.BaseAPI.MakeRequest(String url, String baseUrl, Dictionary`2 payload, String method) in D:\Git\ExchangeSharp\ExchangeSharp\API\BaseAPI.cs:line 332
   at ExchangeSharp.BaseAPI.MakeJsonRequest[T](String url, String baseUrl, Dictionary`2 payload, String requestMethod) in D:\Git\ExchangeSharp\ExchangeSharp\API\BaseAPI.cs:line 362
   at ExchangeSharp.ExchangeBinanceAPI.GetAmountsAvailableToTrade() in D:\Git\ExchangeSharp\ExchangeSharp\API\Exchanges\ExchangeBinanceAPI.cs:line 262
   at ExchangeSharp.ExchangeAPI.<GetAmountsAvailableToTradeAsync>b__26_0() in D:\Git\ExchangeSharp\ExchangeSharp\API\Exchanges\ExchangeAPI.cs:line 245

Missing GetAmountsAvailableToTrade() in Kraken api

public override Dictionary<string, decimal> GetAmountsAvailableToTrade()
{
JToken token = MakeJsonRequest("/0/private/Balance", null, GetNoncePayload());
JToken result = CheckError(token);
Dictionary<string, decimal> balances = new Dictionary<string, decimal>(StringComparer.OrdinalIgnoreCase);
foreach (JProperty prop in result)
{
decimal amount = prop.Value.ConvertInvariant();
if (amount > 0m)
{
symbolNormalizerGlobal.TryGetValue(prop.Name, out string normalized);
balances[normalized.ToUpper()] = amount;
}
}
return balances;
}

Bittrex.Net 1.4.1 is the latest version that doesn't cause error. 2.0.8 is latest stable ver.

I have a [BUG REPORT] or [FEATURE REQUEST]
Bittrex.Net 2.0.8 is latest stable version, but 1.4.1 is the latest version that works with ExchangeBittrexAPI.

Dunno if this is an issue, or is fine as is, just passing this along.

Does not cause any issue unless update to latest stable Bittrex.Net is attempted in NuGet PM.

Details:

Error Logs (if any):
Severity Code Description Project Path File Line Source Suppression State Tool
Error CS0029 Cannot implicitly convert type 'CryptoExchange.Net.CallResult' to 'Bittrex.Net.Objects.BittrexApiResult' ExchangeSharp(netstandard2.0) C:\Users\DJH\Documents\Visual Studio 2017\Projects\Quantum Trader\packages\ExchangeSharp-master\ExchangeSharp\API\Exchanges C:\Users\DJH\Documents\Visual Studio 2017\Projects\Quantum Trader\packages\ExchangeSharp-master\ExchangeSharp\API\Exchanges\ExchangeBittrexAPI.cs 213 Build N/A Compiler

Causes a conversion issue interacting with CryptoExchange.Net.CallResult

ExchangeBittrexAPI.cs:

Line # 213: BittrexApiResult result = SocketClient.SubscribeToAllMarketDeltaStream

Thanks, as always. Strong work!

gdax private api

me again, id happily throw you an LTC tip if you could implement the private side of gdax (mainly the place order, get open orders, and cancel orders).

Thanks either way :)

Binance Account Errors

I have a BUG REPORT.

Details:

Calling GetAmountsAvailableToTrade() or GetAmounts() returns:

2014 BAD_API_KEY_FMT
API-key format invalid.

This could be a newb issue as I am just starting with your API. I have encrypted my key/secret. Any help appreciated. Thanks!

[FEATURE REQUEST]change interface request

Hi,
Thank you for your work.

I think change code

OnCancelOrderAsync(string orderId)
OnGetOrderDetailsAsync(string orderId)

to

OnCancelOrderAsync(string orderId, string symbol = null)
OnGetOrderDetailsAsync(string orderId, string symbol = null)

is better for Binance API.

Allow for MARKET orders with Binance

Hello!

I started to use this and am loving it so far. I noticed that market orders were not implemented with Binance. Could you please add this functionality?

Thanks
Ryan

bug periodInSeconds gives error for polonium exchange

I have a BUG REPORT

Details:
following code gives an API exception "Please specify valid period" for the poloniexapi
Other api's like bittrex and binance work fine


var api = new ExchangePoloniexAPI();
var newCandles = api.GetCandles(" BTC_AMP", (60*60), DateTime.Now.AddMonths(-1));

Async not used correctly

Hey, I am the main dev of https://github.com/btcpayserver/btcpayserver a self hosted payment server which run your own node and support multiple shitcoin on top of bitcoin.

I want to use your API to provide "auto dumping" feature to merchants.

However, it seems that you are using async incorrectly by wrapping sync call with Task.Run.

What you should do is the reverse, using async/await all along the way and use YourMethodAsync().GetAwaiter().GetResult() to make synchronous calls methods.

If I propose a PR fixing all of this, will you merge?

ExchangeBitrexapi Ticker always returning invalid market

I have a BUG REPORT

Details:

        var bitstampapi = new ExchangeBitstampAPI();
        var bitrextapi = new ExchangeBittrexAPI();
        var bitrextTicker = bitrextapi.GetTicker("btcusd"); // this always tells invalid market
        var bitstampticker = bitstampapi.GetTicker("XRPEUR");

Error Logs (if any):
ExchangeSharp.APIException: 'INVALID_MARKET'

ExchangeOrderResult means different things at different exchanges. Can we standardize this?

Comparing Bittrex and Binance:

Bittrex[Price] means the total amount in the base currency.
Binance[Price] means price per unit (I think)

It's not clear what units the different numbers are supposed to be in. Probably different exchanges return different things. Can we get ExchangeSharp to normalize this stuff?

My suggestion:
Amount/AmountFilled are always in the market currency (e,g. ADA)
AveragePrice is price per unit in base/market. E.g. 0.000342 ETH/ADA
Fee is in the base currency
Price means... the price requested? I have no idea what this is for.

My testing:
image

Bitfinex GetCandles only returns 120 items, but the api v2 will return 1000

Just a stupid question, but the Bitfinex getcandles only returns 120 candles, no matter what start and stop time I place. The v1 api doesn't even do candles, but v2 has the candles endpoint, and an unpublished limit of 1000 (from experimenting).

Bittrex getcandles returns about 1420 with same start and end times.

Also, it would be great to have a limit param (overload) instead of times to make it easy to get the latest x candles.

    int i = 0;
    var dd = apiBitfinex.GetCandles("ETHBTC", 3600, new DateTime(2017, 2, 8), new DateTime(2018, 2, 11));
    foreach(var c in dd)
    {
        Console.WriteLine(i.ToString() + "  " + c.Timestamp.ToShortDateString() + "  " + c.Timestamp.ToShortTimeString() + "  " + c.ClosePrice.ToString());
        i++;
        Application.DoEvents();
    }

OUTPUT

.
.
.
116 2/12/2017 8:00 PM 0.01135
117 2/12/2017 9:00 PM 0.011344
118 2/12/2017 10:00 PM 0.01135
119 2/12/2017 11:00 PM 0.01138

Get open orders

Am I crazy or is there no "get open orders" on a pair?

example: get open orders for BTC-USD on gdax

I see that I can place and cancel orders, but you need the order ID, which I cannot get unless I placed the order and saved the ID (which is not always the case). I see I can get the order books, but thats not helpful in this scenario.

Thanks for the awesome solution btw! This is really well done!

Adding to symbolNormalizerGlobal

https://github.com/jjxtra/ExchangeSharp/blob/962ceb196432caad83ff650fc9700d344b010630/ExchangeSharp/API/Exchanges/ExchangeKrakenAPI.cs#L32
adding to symbolNormalizerGlobal() are needed for balance requests

{ "ZEUR", "eur" },
{ "XXBT", "btc" },
{ "XRPL", "rpl" },
{ "XETC", "etc" },
{ "XETH", "eth" },
{ "XICN", "icn" },
{ "XLTC", "ltc" },
{ "XMLN", "mln" },
{ "XREP", "rep" },
{ "XXDG", "dog" },
{ "XXLM", "xml" },
{ "XXMR", "xmr" },
{ "XXRP", "xrp" },
{ "XZEC", "zec" },

async method

Hi Jeff, me again...
I'm trying to implement the async methods but I found some problem, could you please add some examples on how to load some data in async way and bind to a datagrid.

Thank you, any help would be very appreciated

Davide

SimplePeakValleyTrader

I have a Quaestion

I want to test out and use the SimplePeakValleyTrader that's in your code. I have a few questions.
Am I right to say that this trader is not written for every market? The Update amounts function is getting the BTC and USD balances, while it maybe would be better if the base currency and market currency would be retrieved.

Is it possible to create helper functions for all APIs that retrieve the base currency and market currency of a symbol? For example Bittrex uses the following notation: BTC-LTC and Binance uses LTCBTC. It would come in handy if there was a helper function on every API implementation to get the base and amrket currency of the symbol. (in this case BTC is basecurrency and LTC is marketcurrency)

Do you have any tips on what interval I have to begin testing? Minute(s), Hour(s)?

How can I initiate the TradeInfo property? It cannot be set.

Thank you for your answers.
Jacob

Wiki

Greetings.
I wanna use but not wiki and any document. Help or read me too low.
Please help for detailed document or wiki .
[email protected]

dotnet core 2 support

Hello, jjxtra!!!
I am interested if it is possible to run and use your package on dotnet core 2.
Looks like no.
Are you planing to make the package runnable on core?

Thanks.

Websocket APIs

hey @jjxtra !

Do you habe any plans regarding a suuport for websocket APIs? For instance, Bittrex and Gdax have them. That would be super useful.
cheers,
Wojtek

Bug Withdrawal on Bittrex

I have a [BUG REPORT]

It is an simple encoding error on Bittrex withdrawal. If u try to withdrawal "quantity=20" its working fine but if u want to withdrawal for example "quantity=20.123" u can see "quantity=20%2c123" in the url (debugged using fiddler). Would be happy about a fix ;)

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.