Git Product home page Git Product logo

bitmex.net's Introduction

Hi there ๐Ÿ‘‹

Vladimir's GitHub stats

Top Langs

bitmex.net's People

Contributors

ha07z7xe avatar keithswright avatar maderkan avatar ridicoulous avatar semashkinvg avatar tekr 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

Watchers

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

bitmex.net's Issues

Support multiple accounts on REST interface

The current implementation requires separate BitmexApiService instances for each account, as account details (in BitmexAuthorization) are passed in at construction time. This in turn means separate TCP connections for each account.

Providing an alternate interface where account details are passed with a request would allow any number of accounts to share a single connection.

Implement and test BitmexApiUrls.Leaderboard

As a developer, I should have access to the Leaderboard information through the REST API /leaderboard/*

TODO:
uncomment fields under BitmexApiUrls.Leaderboard
fix dtos for the user API requests
add at least 1 integration test for each REST call

Nonce is too large

Bitmex has begun rejecting requests sent using Bitmex.NET with the following error:

System.AggregateException: One or more errors occurred. (Nonce must be a valid number and below 2^53. You sent: 9007402207710664., Code:HTTPError) ---> Bitmex.NET.BitmexApiException: Nonce must be a valid number and below 2^53. You sent: 9007402207710664., Code:HTTPError
at Bitmex.NET.BitmexApiProxy.d__7.MoveNext()

Evidently there is a nonce upper limit of 2^53. Using the formula in NonceProvider.GetNonce():

new DateTime(1990, 1, 1).AddTicks((long)Math.Pow(2, 53)) = 17/7/2018 11:58:45pm

i.e. as of just before midnight last night, generated nonce values are too large.

Implement and Tests WebSocket.funding

as a developer, I want to be able to sign on funding rate changes

TODO:

  1. New subscription in BitmetSocketSubscriptions
  2. Test that shows that subscription works
  3. Use models from REST API, if web scoket model is different - create a new one under Models/Socket

Implement and Tests WebSocket.Chat

as a developer, I want to be able to sign on chat live updates

TODO:

  1. New subscription in BitmetSocketSubscriptions
  2. Test that shows that subscription works
  3. Use models from REST API, if web scoket model is different - create a new one under Models/Socket

Question about WS subscription

Hi Semashkinvg,

In my code I did this:

bitmexApiSocketService.Subscribe(BitmexApiSubscriptionInfo<IEnumerable<OrderBookDto>>.Create(SubscriptionType.orderBookL2, a => { foreach(var d in a) Console.WriteLine(d.ToStr()); })); }

This gave me the output:

BITMX Entry: XBTUSD id:15599217800 side:Sell size:10000 price:7822
BITMX Entry: XBTUSD id:15599217900 side:Sell size:3130 price:7821
BITMX Entry: XBTUSD id:15599218000 side:Sell size:800 price:7820
BITMX Entry: XBTUSD id:15599218050 side:Sell size:50 price:7819.5
BITMX Entry: XBTUSD id:15599218250 side:Sell size:575 price:7817.5
BITMX Entry: XBTUSD id:15599218300 side:Sell size:30 price:7817
...
BITMX Entry: XBTUSD id:15599227400 side:Sell size:6792 price:0
BITMX Entry: XBTUSD id:15599231250 side:Sell size:9864 price:0
BITMX Entry: XBTUSD id:15599235100 side:Sell size:6867 price:0
BITMX Entry: XBTUSD id:15599238900 side:Sell size:6592 price:0

Questions:

  1. There is no indication of whether the action is "partial", "update", "delete" or "insert". Am I supposed to make the guess that if price is 0 then it is an "update", and if size is 0 then it is a "delete" etc?

  2. Also according to https://www.bitmex.com/app/wsAPI#subscriptions I should discard all data before "partial" but how can I know whether a message is "partial" or "insert"?

  3. If I subscribe to orderBook10, all I get are zero entries. Why?

BITMX Entry: EOSU18 id:0 side: size:0 price:0
BITMX Entry: ETHU18 id:0 side: size:0 price:0
BITMX Entry: ETHUSD id:0 side: size:0 price:0
BITMX Entry: LTCU18 id:0 side: size:0 price:0
BITMX Entry: TRXU18 id:0 side: size:0 price:0
BITMX Entry: XBTJPY id:0 side: size:0 price:0
BITMX Entry: XRPU18 id:0 side: size:0 price:0
BITMX Entry: XBTKRW id:0 side: size:0 price:0
BITMX Entry: XBTZ18 id:0 side: size:0 price:0
BITMX Entry: TRXU18 id:0 side: size:0 price:0
BITMX Entry: TRXU18 id:0 side: size:0 price:0

Expires time calculation (previously nonce) must be in future

Commit 4e0c4b3 changed the authentication mechanism from using nonces (problematic in multi-threaded use) to the more-recently-supported 'expires-time' mechanism, however it passes in the current client time as the expiry time. As such, Bitmex may reject the request as expired.

Randomly closes down without any exception

The example program randomly closes down twice for me, each time within 15 hours..

There is no error message or log..

I have another program feeding it small not-often tcp-packets to when it should make an order..

any idea what is causing this..?

.net Standard version

Hi !

It would be excellent if your great lib was compatible with .net standard 2.0.
Right now it's targeting .net 4.5, but it was working in .net standard if I cloned sources and compiled them myself.
But now the lib is using WebSocketSharp 1.0.3-rc11
and it doesn't run in .net standard.

I would be very gratefull if you would port your great lib to the .net standard.

Thanks :)

BitmexApiProxy exceptions are not dejsonized

Hi !

In BitmexApiProxy exceptions in POST, PUT and DELETE are not dejsonized, and are thrown as System.Exception.

It would be great if those exceptions followed the pattern used in GET, and was thrown as BitmexApiException.

That way only one exception handling pattern could be used in client code.
๐Ÿ˜„

should_return_trades_bucketed throwns:

Newtonsoft.Json.JsonSerializationException: Error converting value {null} to type 'System.Int64'. Path '[37].vwap', line 1, position 9073. ---> System.InvalidCastException: Null object cannot be converted to a value type.

TradeSocketSubscription - Bug

Hi,

there seems to be a problem with the Tradesocket.
Whenever I suscribe to TradeSocket, I get Exception.
The grossValue is null, not valid for decimals and therefor, the TradeDto can not be constructed from JToken.

How to prevent this from happening?

Implement and Test WebSocket.Order

as a developer, I want to be able to sign on order live updates

TODO:

  1. New subscription in BitmetSocketSubscriptions
  2. Test that shows that subscription works
  3. Use models from REST API, if web scoket model is different - create a new one under Models/Socket

TradeSubscription events unordered

You can recieve older data after fresh.
I think the issue is in multiple threads used to send data from websocket. I think the issue in underlaying websocket library.

So currently order of events not determined.
Llibrary can't be used for any serious project.

Broken Quote requests

should_return_quotes
should_return_quotes_with_specific_count
should_return_quotes_bucketed

Implement and Tests WebSocket.Wallet

as a developer, I want to be able to sign on wallet updates

TODO:

  1. New subscription in BitmetSocketSubscriptions
  2. Test that shows that subscription works
  3. Use models from REST API, if web scoket model is different - create a new one under Models/Socket

Propogate 503, 429 Error responses

Bitmex returns the following errors in response to overload and rate limit caps respectively:
https://www.bitmex.com/app/restAPI

  • 503 - The system is currently overloaded
  • 429 - You have been rate limited. An additional header Retry-After indicates the number of seconds you should wait before retrying.

Is there a way to propagate this information to the application, so it can handle them appropriately?

Orderbook notifications are sent in different threads

The order book notifications are sent in different threads and this is a problem because you cannot process market data serially. For example if we receive an INSERT Action on orderbook it is sent on a new task and following UPDATE action is sent on a new task which defeats the purpose because you cannot guarantee that the UPDATE task will finish after INSERT task.

Implement and test BitmexApiUrls.Stats

As a developer, I should have access to the stats information through the REST API /stats/*

TODO:
uncomment fields under BitmexApiUrls.Stats
fix dtos for the user API requests
add at least 1 integration test for each REST call

Implement and test BitmexApiUrls.Notification&Liquidation&Funding

As a developer, I should have access to the Leaderboard information through the REST API /notification/, /liquidation/, /funding/

TODO:
uncomment fields under BitmexApiUrls.Notification&Liquidation&Funding
fix dtos for the user API requests
add at least 1 integration test for each REST call

Serialization Bug for Booleans

I get partial candles even if I set Partial as false at TradeBucketedGETRequestParams.
Then I have checked logs and the request was:
https://www.bitmex.com/api/v1/trade/bucketed?binSize=5m&partial=False&symbol=XRPZ18&columns=&count=500&start=&reverse=False&startTime=&endTime=

as you can see booleans starts with uppercase letter "False". Bitmex accept as true anything other than "false". Therefore when we de-serialize object to request params, lowercase letters have to be used.

The project framework is .Net Core 2.1

Implement and test BitmexApiUrls.User

As a developer, I should have access to the user information through the REST API /user/*

TODO:
uncomment fields under BitmexApiUrls.User
fix dtos for the user API requests
add at least 1 integration test for each REST call

http error signature not valid

On bitmex testnet everything works perfect.
I wanted to use this on a real bitmex account so:

Generated new api key
Set {BitmexEnvironment.Prod, "https://bitmex.com"} instead of testnet
Change the env to .Prod

As soon as I want to make an authenticated request it gives me the error:
http error signature not valid

If I check the value of nonce, message and bytearray I get:
nonce is : 8935330312157344
message is : POST/api/v1/position/leverage{"symbol":"XBTUSD","leverage":50.0}8935330312157344
bytearray is : 95b2d43d54dbc62dfb1b1457dbce27bb456d9b9c4366da124259ce980ce8f12f

I generated multiple new api keys but I keep getting the same error,

best regards,
Jens

May I know if this library log its sent and received messages?

Hi semashkinvg,

I've browsed through the code and I can't figure out how logging is enabled / disabled for this .NET library. I often have to look at actual JSON strings sent in WebSocket to troubleshoot trading issues. So I am wondering if a logging facility is built-in.

If not, what is the best way for me to add in such a facility?

Thanks for providing open-sourcing this library!

Implement and Tests WebSocket.announcement

as a developer, I want to be able to sign on anouncements

TODO:

  1. New subscription in BitmetSocketSubscriptions
  2. Test that shows that subscription works
  3. Use models from REST API, if web scoket model is different - create a new one under Models/Socket

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.