Coder Social home page Coder Social logo

jkorf / bittrex.net Goto Github PK

View Code? Open in Web Editor NEW
141.0 18.0 62.0 1.01 MB

A C# .Net wrapper for the Bittrex web API including all features easily accessible and usable

License: MIT License

C# 100.00%
bittrex bittrex-api cryptocurrency exchange bittrexnet csharp dotnet api-wrapper api bittrex-exchange

bittrex.net's Introduction

Bittrex.Net

.NET Nuget version Nuget downloads

Bittrex.Net is a wrapper around the Bittrex API as described on Bittrex, including all features the API provides using clear and readable objects, both for the REST as the websocket API's.

If you think something is broken, something is missing or have any questions, please open an Issue

Documentation

Installation

dotnet add package Bittrex.Net

Support the project

I develop and maintain this package on my own for free in my spare time, any support is greatly appreciated.

Referral link

Sign up using the following referral link to pay a small percentage of the trading fees you pay to support the project instead of paying them straight to Bittrex. This doesn't cost you a thing! Link

Donate

Make a one time donation in a crypto currency of your choice. If you prefer to donate a currency not listed here please contact me.

Btc: bc1qz0jv0my7fc60rxeupr23e75x95qmlq6489n8gh
Eth: 0x8E21C4d955975cB645589745ac0c46ECA8FAE504

Sponsor

Alternatively, sponsor me on Github using Github Sponsors.

Discord

A Discord server is available here. Feel free to join for discussion and/or questions around the CryptoExchange.Net and implementation libraries.

Release notes

  • Version 8.0.3 - 24 Oct 2023

    • Updated CryptoExchange.Net
  • Version 8.0.2 - 09 Oct 2023

    • Updated CryptoExchange.Net version
    • Added ISpotClient to DI injection
    • Updated ISpotClient.GetTickerAsync to return LastPrice as well
  • Version 8.0.1 - 25 Aug 2023

    • Updated CryptoExchange.Net
  • Version 8.0.0 - 25 Jun 2023

    • Updated CryptoExchange.Net to version 6.0.0
    • Renamed BittrexClient to BittrexRestClient
    • Renamed SpotStreams to SpotApi on the BittrexSocketClient
    • Updated endpoints to consistently use a base url without any path as basis to make switching environments/base urls clearer
    • Added IBittrexOrderBookFactory and implementation for creating order books
    • Updated dependency injection register method (AddBittrex)
  • Version 7.1.2 - 18 Mar 2023

    • Updated CryptoExchange.Net
  • Version 7.1.1 - 14 Feb 2023

    • Updated CryptoExchange.Net
  • Version 7.1.0 - 17 Nov 2022

    • Updated CryptoExchange.Net
  • Version 7.0.18 - 19 Aug 2022

    • Added fiat fees endpoint
    • Fixed orderbook subscription message handling
  • Version 7.0.17 - 18 Aug 2022

    • Fixed issue where message were routed to incorrect handler if the symbol of the message started with the same characters as another handler symbol
  • Version 7.0.16 - 18 Jul 2022

    • Updated CryptoExchange.Net
  • Version 7.0.15 - 16 Jul 2022

    • Updated CryptoExchange.Net
  • Version 7.0.14 - 10 Jul 2022

    • Fixed excessive socket data logging in Debug LogLevel
    • Updated CryptoExchange.Net
  • Version 7.0.13 - 12 Jun 2022

    • Updated CryptoExchange.Net
  • Version 7.0.12 - 24 May 2022

    • Updated CryptoExchange.Net
  • Version 7.0.11 - 22 May 2022

    • Updated CryptoExchange.Net
  • Version 7.0.10 - 08 May 2022

    • Fix for reconnecting and added default no-data timeout on socket
    • Updated CryptoExchange.Net
  • Version 7.0.9 - 01 May 2022

    • Fixed socket connection
    • Cleaned up socket id logging
  • Version 7.0.8 - 01 May 2022

    • Updated CryptoExchange.Net which fixed an timing related issue in the websocket reconnection logic
    • Added seconds representation to KlineInterval enum
  • Version 7.0.7 - 14 Apr 2022

    • Updated CryptoExchange.Net
  • Version 7.0.6 - 10 Mar 2022

    • Updated CryptoExchange.Net
  • Version 7.0.5 - 08 Mar 2022

    • Updated CryptoExchange.Net
  • Version 7.0.4 - 01 Mar 2022

    • Updated CryptoExchange.Net improving the websocket reconnection robustness
  • Version 7.0.3 - 27 Feb 2022

    • Updated CryptoExchange.Net to fix timestamping issue when request is ratelimiter
  • Version 7.0.2 - 24 Feb 2022

    • Fixed HeartBeat socket subscription causing errors
    • Fixed thread blocking in socket connecting
    • Updated CryptoExchange.Net
  • Version 7.0.1 - 21 Feb 2022

    • Fixed exception socket order update with open orderbook subscriptions
  • Version 7.0.0 - 18 Feb 2022

    • Added Github.io page for documentation: https://jkorf.github.io/Bittrex.Net/

    • Added unit tests for parsing the returned JSON for each endpoint and subscription

    • Added AddBittrex extension method on IServiceCollection for easy dependency injection

    • Added URL reference to API endpoint documentation for each endpoint

    • Added default rate limiter

    • Refactored client structure to be consistent across exchange implementations

    • Renamed various properties to be consistent across exchange implementations

    • Cleaned up project structure

    • Fixed various models

    • Updated CryptoExchange.Net, see https://github.com/JKorf/CryptoExchange.Net#release-notes

    • See https://jkorf.github.io/Bittrex.Net/MigrationGuide.html for additional notes for updating from V6 to V7

  • Version 6.1.5 - 08 Oct 2021

    • Updated CryptoExchange.Net to fix some socket issues
  • Version 6.1.4 - 06 Oct 2021

    • Updated CryptoExchange.Net, fixing socket issue when calling from .Net Framework
  • Version 6.1.3 - 05 Oct 2021

    • Updated CryptoExchange.Net
  • Version 6.1.2 - 29 Sep 2021

    • Updated CryptoExchange.Net
  • Version 6.1.1 - 23 Sep 2021

    • Fixed exception for post requests without parameters
  • Version 6.1.0 - 20 Sep 2021

    • Added missing SetApiCredentials method
    • Updated CryptoExchange.Net
  • Version 6.0.6 - 15 Sep 2021

    • Updated CryptoExchange.Net
  • Version 6.0.5 - 02 Sep 2021

    • Fix for disposing order book closing socket even if there are other connections
  • Version 6.0.4 - 26 Aug 2021

    • Updated CryptoExchange.Net
  • Version 6.0.3 - 24 Aug 2021

    • Updated CryptoExchange.Net, improving websocket and SymbolOrderBook performance
  • Version 6.0.2 - 19 Aug 2021

    • Added GetTradingFeesAsync endpoint
  • Version 6.0.1 - 13 Aug 2021

    • Fix for OperationCancelledException being thrown when closing a socket from a .net framework project
    • Fixed unsubscribing not working
  • Version 4.0.0 - 12 Aug 2021

  • Version 6.0.0-beta3 - 09 Aug 2021

    • Renamed GetSymbolTradesAsync to GetTradeHistoryAsync
    • Renamed GetExecutionsAsync to GetUserTradesAsync
    • Renamed GetOrderExecutionsAsync to GetOrderTradesAsync
    • Renamed SubscribeToSymbolTradeUpdatesAsync to SubscribeToTradeUpdatesAsync
    • Renamed SubscribeToExecutionUpdatesAsync to SubscribeToUserTradeUpdatesAsync
  • Version 6.0.0-beta2 - 26 Jul 2021

    • Updated CryptoExchange.Net
  • Version 6.0.0-beta1 - 09 Jul 2021

    • Added Async postfix for async methods
    • Updated CryptoExchange.Net
  • Version 5.2.0-beta5 - 07 Jun 2021

    • Fixed BittrexSocketClient Proxy option
    • Updated SignalR client package version
    • Updated CryptoExchange.Net
  • Version 5.2.0-beta4 - 27 May 2021

    • Fix for stream data deserialization
  • Version 5.2.0-beta3 - 26 May 2021

    • Removed non-async calls
    • Updated to CryptoExchange.Net changes
  • Version 5.2.0-beta2 - 06 mei 2021

    • Updated CryptoExchange.Net
  • Version 5.2.0-beta1 - 30 apr 2021

    • Updated to CryptoExchange.Net 4.0.0-beta1, new websocket implementation
  • Version 5.1.1 - 04 mei 2021

    • Allow TimeInForce null in BittrexOrder result
    • Added GetExecutionById endpoint
  • Version 5.1.0 - 28 apr 2021

    • Added batch order placement/cancellation
  • Version 5.0.3 - 19 apr 2021

    • Updated CryptoExchange.Net
  • Version 5.0.2 - 30 mrt 2021

    • Updated CryptoExchange.Net
  • Version 5.0.1 - 15 mrt 2021

    • Fixed socket client authentication
  • Version 5.0.0 - 11 mrt 2021

    • Dropped support for V1 API, removed V3 post fixes
    • Added permission endpoints
    • Added executions endpoint
    • Added KlineType to kline endpoints
    • Added execution subscription on socket client
  • Version 4.3.1 - 01 mrt 2021

    • Added Nuget SymbolPackage
  • Version 4.3.0 - 01 mrt 2021

    • Added config for deterministic build
    • Updated CryptoExchange.Net
  • Version 4.2.2 - 22 jan 2021

    • Updated for ICommonKline
  • Version 4.2.1 - 14 jan 2021

    • Updated CryptoExchange.Net
  • Version 4.2.0 - 21 dec 2020

    • Fix for pageSizes being limited to 100 while max is 200
    • Added SubscribeToHeartbeatAsync on BittrexSocketClientV3
    • Updated CryptoExchange.Net
    • Updated to latest IExchangeClient
  • Version 4.1.9 - 11 dec 2020

    • Updated CryptoExchange.Net
    • Implemented IExchangeClient
  • Version 4.1.8 - 19 nov 2020

    • Added conditional order subscription to socket client
    • Changed operand on conditional order to an enum
    • Added clientWithdrawalId to withdraw methods and models
    • Updated v3 market/currency models
  • Version 4.1.7 - 08 Oct 2020

    • Fix for double events for kline subscriptions
    • Updated CryptoExchange.Net
  • Version 4.1.6 - 03 Sep 2020

    • Fixed V3 GetOrderBook limit parameter serialization
  • Version 4.1.5 - 31 Aug 2020

    • Added GetSequence extension method documentation
    • Added GetOrderBook limit parameter
  • Version 4.1.4 - 28 Aug 2020

    • Updated CryptoExchange
    • Updated BittrexSymbolOrderBook to V3
  • Version 4.1.3 - 12 Aug 2020

    • Updated CryptoExchange.Net
  • Version 4.1.2 - 05 Aug 2020

    • Fixed GetHistoricalKlines date parameters
    • Added overloads on the V3 socket client to subscribe multiple symbols at once
  • Version 4.1.1 - 20 Jul 2020

    • Fixed reference
  • Version 4.1.0 - 20 Jul 2020

    • Updated V3 rest client
    • Added V3 socket client
  • Version 4.0.10 - 21 Jun 2020

    • Updated CryptoExchange
  • Version 4.0.9 - 16 Jun 2020

    • Updated CryptoExchange.Net
  • Version 4.0.8 - 074 Jun 2020

    • Updated CryptoExchange
  • Version 4.0.7 - 03 Mar 2020

    • Updated CryptoExchange
  • Version 4.0.6 - 27 Jan 2020

    • Updated CryptoExchange.Net
  • Version 4.0.5 - 14 Nov 2019

    • Fixed NotImplementedException sometimes being triggered when reconnecting
  • Version 4.0.4 - 12 Nov 2019

    • Added retry on SignalR hub invoke for websockets
  • Version 4.0.3 - 27 oct 2019

    • Fixed GetOrderBook in socket client
  • Version 4.0.2 - 23 Oct 2019

    • Fixed summary symbol mapping
  • Version 4.0.1 - 23 Oct 2019

    • Fixed symbol validation
  • Version 4.0.0 - 23 Oct 2019

    • See CryptoExchange.Net 3.0 release notes
    • Added input validation
    • Added CancellationToken support to all requests
    • Now using IEnumerable<> for collections
    • Renamed Candle -> Kline
    • Renamed Market -> Symbol
    • Renamed ExchangeState -> OrderBook
  • Version 3.1.8 - 06 Oct 2019

    • Changed ask/bid in BittrexStreamMarketSummary to be nullable
  • Version 3.1.7 - 15 Aug 2019

    • Updated code docs
    • Updated V3 client
  • Version 3.1.6 - 07 Aug 2019

    • Updated CryptoExchange.Net
  • Version 3.1.5 - 05 Aug 2019

    • Added xml file for code documentation
  • Version 3.1.4 - 09 jul 2019

    • Updated BittrexSymbolOrderBook
  • Version 3.1.3 - 14 may 2019

    • Added an order book implementation for easily keeping an updated order book
    • Added additional constructor to ApiCredentials to be able to read from file
  • Version 3.1.2 - 06 may 2019

    • Fixed limit being a nullable field on orders
  • Version 3.1.1 - 06 may 2019

    • Fixed market order type parsing
    • Added support for the V3 open beta API
  • Version 3.1.0 - 01 may 2019

    • Updated to latest CryptoExchange.Net
      • Adds response header to REST call result
      • Added rate limiter per API key
      • Unified socket client workings
  • Version 3.0.9 - 09 mar 2019

    • Fixed stream order condition parsing
  • Version 3.0.8 - 08 mar 2019

    • Fixed Bid/Ask being nullable in market summary
  • Version 3.0.7 - 07 mar 2019

    • Fixed parsing of ConditionType
    • Fixed linq exception on Query in socket client
  • Version 3.0.6 - 01 mar 2019

    • Fixed nullable fields in orders
    • CallResult to WebCallResult for BittrexClient
  • Version 3.0.5 - 01 feb 2019

    • Updated CryptoExchange.Net
  • Version 3.0.4 - 11 jan 2019

    • Updated CryptoExchange.Net
  • Version 3.0.3 - 29 dec 2018

    • Updated CryptoExchange.Net
  • Version 3.0.2 - 17 dec 2018

    • Fix for error while reconnecting
  • Version 3.0.1 - 06 dec 2018

    • Fix for socket client
    • Fix for freezes if called from UI thread
  • Version 3.0.0 - 05 dec 2018

    • Updated to CryptoExchange.Net version 2
      • Libraries now use the same standard functionalities
      • Objects returned by socket subscriptions standardized across libraries
  • Version 2.1.20 - 05 nov 2018

    • Fix for v2 api methods resulting in INVALID_SIGNATURE
  • Version 2.1.19 - 01 nov 2018

    • Fix MarketSummaryLite failing to deserialize when there is a new market without data
  • Version 2.1.18 - 25 sep 2018

    • Fixed PlaceConditionalOrder endpoint
  • Version 2.1.17 - 21 sep 2018

    • Updated CryptoExchange.Net
    • Fixed Kline methods
  • Version 2.1.16 - 21 aug 2018

    • Fix for default api credentials getting disposed
  • Version 2.1.15 - 20 aug 2018

    • Updated CryptoExchange.Net for bugfix
  • Version 2.1.14 - 16 aug 2018

    • Added interface for socket client
    • Fixed some minor Resharper warnings
    • Updated CryptoExchange.Net
  • Version 2.1.13 - 13 aug 2018

    • Fixed auth calls
  • Version 2.1.12 - 13 aug 2018

    • Updated CryptoExchange.Net
  • Version 2.1.11 - 13 aug 2018

    • Updated CryptoExchange.Net
  • Version 2.1.10 - 03 jul 2018

    • Small fix socket event binding
  • Version 2.1.9 - 25 jun 2018

    • Updated base rest api address
  • Version 2.1.8 - 08 jun 2018

    • Fix for broken datettime parsing
  • Version 2.1.7 - 08 jun 2018

    • Fix DateTime objects to have Kind set to Utc
  • Version 2.1.6 - 04 jun 2018

    • Added additional events for socket connection
    • Fix for null reference in QueryExchangeState
  • Version 2.1.5 - 09 may 2018

    • Added support for multiple accounts in socket client
  • Version 2.1.4 - 07 may 2018

    • Fix for logging issue
  • Version 2.1.3 - 07 may 2018

    • Moved from beta endpoint to release endpoint
    • Updated CryptoExchange.Net base
  • Version 2.1.2 - 17 apr 2018

    • Fix for failed resubscribe handling after connection is restored
    • Additional error checking on socket data
  • Version 2.1.1 - 06 apr 2018

    • Fixed reconnect when connection is closed without error
    • More error checking in socket client
  • Version 2.1.0 - 05 apr 2018

    • Updated to new Bittrex beta socket implementation
    • Cleaned reconnection logic
  • Version 2.0.10 - 23 mar 2018

    • Fix for CloudFlare bypass
    • Updated socket dispose
    • Updated base
  • Version 2.0.9 - 21 mar 2018

    • Allow multiple log writers
  • Version 2.0.8 - 12 mar 2018

    • Updated packages to fix freezing when called from UI thread
  • Version 2.0.7 - 09 mar 2018

    • Updated base
  • Version 2.0.6 - 09 mar 2018

    • Fix for exception when parsing PlaceConditionalOrder result
    • Fix for UI thread freezing
  • Version 2.0.5 - 08 mar 2018

    • Cleaned socket implementation
  • Version 2.0.4 - 08 mar 2018

    • Removed initial try without CloudFlare cookies in socket client
    • Cleanup, removed unused files
  • Version 2.0.2/2.0.3 - 05 mar 2018

    • Fix for freezes when calling from UI thread
  • Version 2.0.1 - 03 mar 2018

    • Fix for bug in URL building
  • Version 2.0.0 - 01 mar 2018

    • Updated to use a base package, which introduces some changes in syntax, but keeps functionality unchanged
  • Version 1.4.1 - 26 feb 2018

    • Small fixes
  • Version 1.4.0 - 26 feb 2018

    • Changed how to set (default) options
    • Added SetProxy to REST client
    • Fix for OrderSide being default in some returns
  • Version 1.3.15 - 21 feb 2018

    • Fix for wrong orderside in socket exchange delta event
  • Version 1.3.14 - 21 feb 2018

    • Fix for Trade updates from websocket not containing Price/Rate
  • Version 1.3.13 - 20 feb 2018

    • Fix for ExchangeDeltas update for a market being called for all subscriptions
  • Version 1.3.12 - 20 feb 2018

    • Added V2 order endpoint to support conditional orders
    • Combined BittrexExchangeState and BittrexStreamExchangeState
  • Version 1.3.11 - 15 feb 2018

    • Fix for freezes when making calls from UI thread
  • Version 1.3.10 - 15 feb 2018

    • Fix for MarketName being Null in QueryExchangeState
    • Cleaned BittrexSocketClient and ExchangeState objects
    • Fix for error messages being duplicated
  • Version 1.3.9 - 07 feb 2018

    • Fix for deadlock if certain methods were called from the UI thread
  • Version 1.3.8 - 31 jan 2018

    • Added Notice field to BittrexCurrency response
    • Added Notice, LogoUrl and IsSponsored fields to BittrexMarketSummary response, removed DisplayMarketName which is no longer returned (was always null)
    • Changed BittrexMarketSummary fields to nullable decimals since they can be null for new markets
  • Version 1.3.7 - 17 jan 2018

    • Updated CloudFlareUtilities package to fix socket connection
  • Version 1.3.6 - 12 jan 2018

    • Added missing merge
  • Version 1.3.5 - 12 jan 2018

    • Added orderbook websocket endpoints
    • Added basic proxy functionality
    • Small fixed in order json parsing
    • Fix for nullreference when theres no connection
  • Version 1.3.4 - 04 jan 2018

    • Fix for websockets for all platforms
  • Version 1.3.3 - 02 jan 2018

    • Fix for stream connections on platforms with Websocket protocol supported
    • Parallel foreach for stream event callbacks to improve performance
  • Version 1.3.2 - 11 dec 2017

    • Added baseUrl parameter to constructor for mocking
    • Added IBittrexClient interface for mocking
  • Version 1.3.1 - 29 nov 2017

    • Added candle endpoints
    • Made ExecuteRequest and GetUrl protected so they can be overridden
    • Fixed some small potential threading problems
  • Version 1.3.0 - 24 nov 2017

    • Changed websocket implementation to support new Bittrex socket implementation on all platforms
    • Added SubscribeToMarketDeltaStreamAsync which returns a Task
  • Version 1.2.2 - 20 nov 2017

    • Temporary fix for BittrexSocketClient connection after changes on the Bittrex socket API
  • Version 1.2.1 - 15 nov 2017

    • CloudFlare is now used as backup, it'll first try without. This should improve connection time when CloudFlare isn't enabled
  • Version 1.2.0 - 13 nov 2017

    • NETStandard2.0 supported now
    • Extended CloudFlare bypass for more platforms
  • Version 1.1.3 - 13 nov 2017

    • Added CloudFlare bypass in socket client
  • Version 1.1.2 - 10 nov 2017

    • Added ratelimiting options
    • Added connection lost/restored events in socket client
    • Added log verbosity None to be able to mute all logging
    • Added encryptor to dispose
  • Version 1.1.1 - 9 nov 2017

    • Fix for error in wrong category
    • Small code documentation fixes
  • Version 1.1.0 - 9 nov 2017

    • Added automatic configurable retry on server errors
    • Refactor on error returns
  • Version 1.0.1 - 8 nov 2017

    • Added reconnect functionality in socket client as long as there are still subscriptions open
  • Version 1.0.0 - 6 nov 2017

    • Release version 1.0.0
    • Additional unit tests, also for the socket client
    • Small refactoring for unit testability
    • Small cleanup
  • Version 0.0.4 - 4 nov 2017

    • Added icon
  • Version 0.0.3 - 1 nov 2017

    • Small naming changes in socket client
    • Added api key checks in private endpoints
    • Updated documentation
    • Added example project
  • Version 0.0.2 - 1 nov 2017

    • Added BittrexSocketClient
    • Updated documentation

bittrex.net's People

Contributors

aydinadn avatar burakoner avatar d-ugarov avatar dependabot[bot] avatar egorpavlikhin avatar fritz-net avatar jkorf avatar jonnern avatar naile avatar ridicoulous avatar rutgervanwilligen avatar shigengyu avatar vslee 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

bittrex.net's Issues

Consistently get 503 errors using BittrexSocketClient

Using:

var socketClient = new BittrexSocketClient();
socketClient.SetLogVerbosity(LogVerbosity.Debug);
await socketClient.SubscribeToAllMarketDeltaStreamAsync(...)

I keep getting this:

03:12:02:046 | Debug | Going to subscribe to all markets
03:12:02:102 | Debug | Starting connection to bittrex server
03:12:02:137 | Debug | Socket state: Disconnected -> Connecting
03:12:02:396 | Debug | Socket state: Connecting -> Disconnected
03:12:02:403 | Warning | Couldn't connect to Bittrex server, going to try CloudFlare bypass
03:12:02:449 | Debug | Socket closed
03:12:08:326 | Debug | CloudFlare cookies retrieved, retrying connection
03:12:08:332 | Debug | Socket state: Disconnected -> Connecting
03:12:08:952 | Error | Socket error: HTTP/1.1 503 Service Temporarily Unavailable
03:12:08:992 | Error | Socket error: Socket is not connected
03:12:13:534 | Debug | Socket state: Connecting -> Disconnected
03:12:13:541 | Debug | Socket closed
03:12:13:556 | Warning | Call failed: Could not connect to Bittrex server

This is also after I try visiting the website through a browser to trigger the CloudFlare check on the browser. BittrexClient meanwhile seems to work fine.

GetCandles for EVERY currency is very slow - any way to improve?

Hi JKorf & all,

I my Winform application, at the start I need to get candles of every currency (interval = one hour) in order to calculate the top 50 currencies that have risen the most in a given period (i.e. 1 hour, 1 day, 1 week, 1 month etc.)

However, if I run GetCandles() in a single thread, it takes up to 10 minutes to get all the candle data (because each currency has hundreds of candle entries).

I have also tried implementing multi-threading (i.e. 266 parallel threads for 266 currencies, only do once when app starts) but it doesn't improve.

Is there any way to work around this? Or what would be the best way to implement this?

Thanks in advance for any advice.

P.S. I am not sure if this "issue" is relevant but since there is no forum, I hope you don't mind that I post it here.

Kind regards,
Dave

Cannot connect to websocket

Hi,

I try to use the websocket client but it won't connect: Debug log:

03:26:20:764 | Debug | Socket state: Connecting -> Disconnected
03:26:20:766 | Warning | Couldn't connect to Bittrex server, going to try CloudFlare bypass
03:26:20:769 | Debug | Socket closed
03:26:25:926 | Debug | CloudFlare cookies retrieved, retrying connection
03:26:25:928 | Debug | Socket state: Disconnected -> Connecting
03:26:26:216 | Debug | Socket state: Connecting -> Disconnected
03:26:26:218 | Debug | Socket closed
03:26:26:245 | Warning | Call failed: Could not connect to Bittrex server

I could login to Bittrex via the browser.

Hope you can help me out.

Kind regards,
Ton Snoei

Bittrex websocket connection

Hello,

I'm trying to get live data using the bittrex socket client but i keep getting errors.
The client doesn't connect to the remote host.

11:58:37:530 | Debug | Going to subscribe to BTC-ETH

11:58:37:596 | Debug | Starting connection to bittrex server
11:58:37:770 | Debug | Socket state: Disconnected -> Connecting
11:58:38:536 | Debug | Socket state: Connecting -> Disconnected
11:58:38:554 | Debug | Socket closed

11:58:38:556 | Warning | Couldn't connect to Bittrex server, going to try CloudFlare bypass
11:58:38:699 | Debug | CloudFlare cookies retrieved, retrying connection
11:58:38:699 | Debug | Socket state: Disconnected -> Connecting
11:58:38:798 | Debug | Socket state: Connecting -> Disconnected
11:58:38:799 | Debug | Socket closed
11:58:38:807 | Warning | Call failed: Could not connect to Bittrex server

I installed this wrapper (v1.3.4) using nuget.

Do you have an idea on why it cant connect ?

Thanks in advance.

Exception thrown in GetBalance if no wallet address is claimed

I've stumbled upon a deserialization error in the GetBalance(string) call. The problem arises when getting the balance for a specific currency for which you haven't claimed a wallet yet on your Bittrex account. The (successful) JSON response from Bittrex is as follows:

{
	"success": true,
	"message": "",
	"result": {
		"Currency": "LTC",
		"Balance": null,
		"Available": null,
		"Pending": null,
		"CryptoAddress": null
	}
}

Deserialization fails because the null values of Balance, Available and Pending cannot be deserialized into decimals; the full error message is "Error parsing the returned data to object.\r\nMessage: Error converting value {null} to type 'System.Decimal'. Path 'result.Balance', line 1, position 70.. Received data: {\"success\":true,\"message\":\"\",\"result\":{\"Currency\":\"LTC\",\"Balance\":null,\"Available\":null,\"Pending\":null,\"CryptoAddress\":null}}".

One could reason that throwing an exception is a good idea here (because the requested wallet does not exist for the specified currency), but I would argue that that should be part of application logic instead (as in this JSON response, success is set to true). I would therefore change the data types of the BittrexBalance fields to nullable decimals instead.

GetOrderHistory not working?!

Hi,

I am getting along just fine. Only thing is now
var orderHistory = client.GetOrderHistory("BTC-NEO");
is returning success but the collection is empty?

I expected a collection with the history of NEO but it has 0 elements.
Other functions llike GetBalance and GetBalances work just fine.

Can you help me finding the issue here?

Thanks and regards,

Tom

About GetOrderHistory func.

Hi, today I started to try your wrapper. GetTicker, GetOrderBook and GetOpenOrders worked well but GetOrderHistory doesn't work. I don't understand why it always return 0 element in array.

client.GetOrderHistory("USDT-BTC").Result;

here is my completed order list;

image

Thanks

Request for order the book depth in get_orderbook endpoint

Hi, I know that the get_orderbook v1.1 endpoint supports 3rd 'depth' parameter, which allows to limit orderbook entries:

This can be seen in Python Bittrex wrapper. Is it possible to add this parameter to the respective methods?

` def get_orderbook(self, market, depth_type, depth=20):
"""
Used to get retrieve the orderbook for a given market

	:param market: String literal for the market (ex: BTC-LTC)
	:type market: str

	:param depth_type: buy, sell or both to identify the type of orderbook to return.
		Use constants BUY_ORDERBOOK, SELL_ORDERBOOK, BOTH_ORDERBOOK
	:type depth_type: str

	:param depth: how deep of an order book to retrieve. Max is 100, default is 20
	:type depth: int

	:return: Orderbook of market in JSON
	:rtype : dict
	"""
	return self.api_query('getorderbook', {'market': market, 'type': depth_type, 'depth': depth})

`

Could not connect to Bittrex server

Hey @JKorf ,

first of all many thanks for making this project public. I was trying it out with the example code. The REST part works fine, but I have a problem with signalr client.

While I'm trying to run this:

using System;
using Bittrex.Net;
using Bittrex.Net.Logging;


namespace Examples
{
    class Program
    {
        static void Main(string[] args)
        {
            BittrexDefaults.SetDefaultApiCredentials("***", "***");
            BittrexDefaults.SetDefaultLogOutput(Console.Out);
            BittrexDefaults.SetDefaultLogVerbosity(LogVerbosity.Debug);

            var socketClient = new BittrexSocketClient();
            var subcribtion = socketClient.SubscribeToMarketDeltaStream("BTC-ETH",
                summary => { Console.WriteLine($"BTC-ETH: {summary.Last}"); });
                      
            Console.ReadLine();
            socketClient.UnsubscribeFromStream(subcribtion.Result);

        }
    }
}

I'm getting this output:

01:29:38:783 | Debug | Going to subscribe to BTC-ETH
01:29:38:800 | Debug | Starting connection to bittrex server
01:29:38:806 | Debug | Socket state: Disconnected -> Connecting
01:29:39:058 | Debug | Socket state: Connecting -> Disconnected
01:29:39:065 | Debug | Socket closed
01:29:39:067 | Warning | Call failed: Could not connect to Bittrex server

Could you give me some tips what am I doing wrong?

Cheers,
Wojtek

Weekly & Monthly market data

Hi JKorf,

Thanks so much for the very useful and easy to use library.
I just wanted to know if you intend to implement Weekly & Monthly data. When should we expect it?

God bless.
Dave

Fix cloudflare utilities packages

CloudFlareUtilities package can't automatically install for some reason. Does work when manually installing and installing this wrapper after. Comes with multiple dependencies though because it is a .netstandard library.

Check for fix/alternative.

why in double and not decimal.

since you have all the formats in double some numbers get displayed as 4.695E-05.
Also about the websocket, it seems rather slow on asks and bids.
how often is it updating.
Thanks love the work.

Call failed: Could not connect to Bittrex server

Http error 400 (bad request) is returned from signalr api when I try to connect

10:47:09:206 | Error | Socket error: StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.NoWriteNoSeekStreamContent, Headers:
{
  Date: Mon, 20 Nov 2017 09:47:09 GMT
  Transfer-Encoding: chunked
  Connection: keep-alive
  Cache-Control: no-cache
  Pragma: no-cache
  X-Content-Type-Options: nosniff
  X-Content-Type-Options: nosniff
  Strict-Transport-Security: max-age=15768000
  X-XSS-Protection: 1; mode=block
  X-Download-Options: noopen
  Server: cloudflare-nginx
  CF-RAY: 3c0a7c717d844304-MXP
  Content-Type: text/html
  Expires: -1
}
10:47:09:214 | Warning | Call failed: Could not connect to Bittrex server

My code:

let ws = new BittrexSocketClient() 
ws.SubscribeToMarketDeltaStream(pair.symbol, fun x -> printfn "%A" x)

Could it be related to cloudflare?
Downgrading to 1.2.0 which worked previously doesn't solve the problem

No response on API call

Hi there,

I am trying to use the GetMarkets method and my app keeps hanging because no result comes back from Bittrex API? Here's my snippet:

BittrexClient client = new BittrexClient();
var result = client.GetMarkets();

if (result.Success)
{
    //do stuff
}

Proper proxy implementation for all parts of lib

This issue is not very important!

As Websocket4net and WebsocketSharp now support proxying there should also be the possibility to set a proxy for all other parts of the application (for people who maybe run this in an business environment)

NativeWebsockets don't support proxies yet -> #42 (comment)

NullReferenceException when the network is offline

Hi, I'm testing the client error handling on disconnected network and I gen a NullReferenceException from the method GetLatestCandleAsync. Seems it comes from protected method ExecuteRequest. Here's the exception trace:

at Bittrex.Net.BittrexClient.<ExecuteRequest>d__861.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Bittrex.Net.BittrexClient.<ExecuteRequest>d__861.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Bittrex.Net.BittrexClient.<ExecuteRequest>d__861.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Bittrex.Net.BittrexClient.<GetLatestCandleAsync>d__63.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at CryptoService.Data.Services.BittrexService.<>c__DisplayClass13_1.<b__0>d.MoveNext() in C:\Users\andrew.sloven\Workspaces\CryptoSwag\CryptoService\CryptoService.Data\Services\BittrexService.cs:line 177`

Working with winforms

Hi,

Is there a sdk to guide me using this in a winform project?
Can't seem to get it working there.

Many thanks,

Tom

Doesn't work with ASP.NET?

Hi,

I am running the below C# function in both ASP.NET Web Forms and ASP.NET MVC but on MVC it exits right away without result, and on Web Forms it simply runs forever.

var r = client.GetCandles("BTC-ETH", Bittrex.Net.Objects.TickInterval.OneDay);

My super-simple VS project that invokes the function is: HERE
It's inside Default.aspx

I have also tried the async function to no avail.
It runs well in Winform though (even with async).

Please advise.

Thanks so much!
Dave

BittrexOrder object is not the same in getorderhistory and getorder API-calls

The BittrexOrder object contains the CommissionPaid field, but the JSON response of the GetOrderHistory command includes a Commission field rather than CommissionPaid. As a result, the value for Commission isn't deserialized and CommissionPaid is set to 0 without any errors.

I've found out that the API-calls to getorderhistory and getorder both return Order objects, but with slightly different fields. Because of this, I'll create a pull request in which I'll split the BittrexOrder object into separate objects.

Change double type to decimal

I would like to see this library using decimals instead of doubles. This is important because of accuracy and precision in rounding (see this SO question, in which this is discussed).

I'd be happy to help with a pull request!

Features

Would you add subscribe to all markets instead subscribing to them in foreach?
Something like:
bool subscribeToall = false;
private Action onUpdateAll;

public async Task<BittrexApiResult> SubscribeToAllMarketDeltaStream(Action onUpdate){
subscribeToAllSummaries = true;
onUpdateAll = onUpdate;
...........
}

private void SocketMessage(IList jsonData){
if (subscribeToAllSummaries) {
foreach (var delta in data.Deltas)
onUpdateAll(delta);
}
else
{
foreach (var delta in data.Deltas)
foreach (var update in registrations.Where(r => r.MarketName == delta.MarketName))
update.Callback(delta);
}
}

Make BittrexClient class more extendable (private -> protected)

Hi,

Please change the access modifier for ExecuteRequest and GetUrl from private to protected

private async Task<BittrexApiResult<T>> ExecuteRequest<T>(Uri uri, bool signed = false, int currentTry = 0)

private Uri GetUrl(string endpoint, string api, string version, Dictionary<string, string> parameters = null)

This would make the class easier to extend. One use-case would be for consumers of this library to implement undocumented apis not currently supported by this library, such as

https://bittrex.com/Api/v2.0/pub/market/GetTicks?marketName=BTC-WAVES&tickInterval=thirtyMin&_=1499127220008

Thanks,
Alan Castro

BittrexApiResult

Hey :)

Did you think about wrapping the BittrexApiResult with Threading.Task ? This would make consuming of asynchronous calls much easier and faster.

Cheers,
Wojtek

Enable accepting API base URL as constructor parameter

Could you possibly add an overload of the BittrexClient constructor with an extra parameter to override the Bittrex API base URL? This makes unit testing a whole lot easier (e.g. you would then be able make the client point to a mock HTTP server, serving mock JSON data, in order to test whether or not the client correctly handles/deserializes responses and error messages). It would enable us to test our application easier, too.

Once again, I'd be happy to help!

Stream quotes performance improvement

Hello there!

I suggest to improve performance by refactoring this part of code:

            foreach (var allRegistration in allRegistrations)
                allRegistration.Callback(data.Deltas);

            foreach (var delta in data.Deltas)
                foreach (var update in marketRegistrations.Where(r => r.MarketName == delta.MarketName))
                   update.Callback(delta);

of BittrexSocketClient.cs to use ParallelForEach to call callbacks for the different markets/deltas in parallel threads.

Help with vb format

Hi just wondering if anyone could convert this to visual basic, im having a hard time with the syntax format.

using(var socketClient = new BittrexSocketClient())
{
var subcribtionSuccess = socketClient.SubscribeToMarketDelta("BTC-ETH", data =>
{
// Handle data
});

socketClient.UnsubscribeFromStream(subcribtionSuccess.Result); // Unsubscribes a single sub
    socketClient.UnsubscribeAllStreams(); // Unsubscribes all subs on this client 

}

Thank you

SubscribeToMarketDeltaStreamAsync return succes but never be updated...

Hello, i am facing a problem while i'm attempting to receive deltas update...

var socket = new BittrexSocketClient();
var subscription = await socket.SubscribeToMarketDeltaStreamAsync("XRP-BTC", (summary) =>
{
      Console.WriteLine(summary);
});
`

Debug:
 [All packages and projects are compatible with .NETCoreApp,Version=v2.0 (win-x86).]


01:49:09:472 | Debug | Going to subscribe to XRP-BTC
01:49:09:591 | Debug | Starting connection to bittrex server
01:49:10:034 | Debug | Socket state: Disconnected -> Connecting
01:49:14:433 | Debug | Socket state: Connecting -> Connected

And noting more... no error... nothing
Have I forgotten something?

Cannot install the package with .Net 4.6.1

When install the package into my project under VS 2015, the below error happens:

Unable to find a version of 'CloudFlareUtilities' that is compatible with 'Bittrex.Net 1.3.4 constraint: CloudFlareUtilities (>= 0.5.0-alpha)'.

Extra WebSocket endpoints

Hey, first of all thanks for this library.

I have a question. Does the library provide any way to access the extra endpoints on the WebSocket socket client, for instance SubscribeToExchangeDeltas?

error 6000 INVALID_PERMISSION

Hi, i get 6000 INVALID_PERMISSION error when i call GetBalance method.

var client = new BittrexClient(bittrexApiKey, bittrexApiSecret);
using (client)
{
client.SetApiCredentials(bittrexApiKey, bittrexApiSecret);
var quantity = client.GetBalance("BTC");
}

Issues in Request.Cs

I seem to be getting an issue in the Request.cs class at the bold points:

public class Request : IRequest
{
public readonly WebRequest request;

    private Request(WebRequest request)
    {
         this.request = request;
    }

public WebHeaderCollection Headers
{
get => request.Headers;
set => request.Headers = value;

}
public string Method
{
get => request.Method;
set => request.Method = value;

}

I don't think that the Headers object from IRequest is being properly implemented here. Sorry if this is a noob issue.

Error message: INVALID_SIGNATURE

Hi,

This is my code to just get order history on a BTC-GRS pair. But, the same error also appears when I try and buy or sell.

        BittrexDefaults.SetDefaultApiCredentials("xxxx", "yyyy");
        BittrexDefaults.SetDefaultLogOutput(Console.Out);
        BittrexDefaults.SetDefaultLogVerbosity(LogVerbosity.Debug);

        using (var client = new BittrexClient())
        {
            client.MaxRetries = 3;

            var markets = client.GetMarkets();

            var orderHistory = client.GetOrderHistory("BTC-GRS");

        }

        Console.ReadKey();

The error is (Error Code 6000):
05:13:53:093 | Debug | Call failed to https://www.bittrex.com/api/v1.1/account
/getorderhistory?market=BTC-GRS, Error message: INVALID_SIGNATURE

Please note I've taken out my api key and secret key but I believe they're both valid.

Any ideas?

Thanks
Gary

Websocket Orderbook and All Trades

Dear J. Korf!
Thank you for providing this library and the example code.
Could you add a template for processing of websocket data to get an in memory copy of the orderbook and the recent trades of all currencies?
Are you planning on implementing Bitfinex or Poloniex too?
Is there a way to contact you directly?
Best regards,
Björn

Can't connect to websocket anymore

Hi JKorf,

first off, thanks for putting this library out there, it's a real time safer and the only (good) one i could find of which who supports websockets.

Speaking of websockets, since a few days i cannot connect to stream.bittrex.com using the BittrexSocketClient anymore. It keeps saying connection disconnected. Also tried running some older versions of which i knew would work but they all seem to yield the same error. So im guessing something has changed on their side, could you be so kind to look into this?

The error im getting (but the same counts for 'all markets'):
08:49:20:159 | Debug | Going to subscribe to BTC-DOGE
08:49:22:345 | Debug | Starting connection to bittrex server
08:49:22:360 | Debug | Socket state: Disconnected -> Connecting
08:49:22:520 | Debug | Socket state: Connecting -> Disconnected
08:49:22:521 | Warning | Couldn't connect to Bittrex server, going to try CloudFlare bypass
08:49:22:526 | Debug | Socket closed
08:49:30:025 | Debug | CloudFlare cookies retrieved, retrying connection
08:49:30:028 | Debug | Socket state: Disconnected -> Connecting
08:49:30:091 | Debug | Socket state: Connecting -> Disconnected
08:49:30:092 | Debug | Socket closed

Nuget Package error

Unable to resolve dependencies. 'CloudFlareUtilities 0.1.0.2' is not compatible with 'Bittrex.Net 1.3.3 constraint: CloudFlareUtilities (>= 0.5.0-alpha)'.

Might be some mistake in describing the dependencies?

i think the dependencies from .NET Standard have been copied over to other .NET framework versions

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.