semashkinvg / bitmex.net Goto Github PK
View Code? Open in Web Editor NEWWrapper for BitMEX.com REST & WebSocket API
License: MIT License
Wrapper for BitMEX.com REST & WebSocket API
License: MIT License
Hi
Bitmex.NET.Example/MainWindowViewModel:
I think in line 182, "Union(dto.Asks.Select(" might have to be changed to "Union(dto.Bids.Select(", because Asks were already extracted in line 180.
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.
Currently every REST API call uses a new TCP connection. The unnecessarily slows down operations (due to TCP handshake overhead), as well as consuming additional resources.
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
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.
as a developer, I want to be able to sign on funding rate changes
TODO:
as a developer, I want to be able to sign on chat live updates
TODO:
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:
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?
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"?
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
The object WebSocket is not receiving any welcome message,
so it's not connecting to wss://www.bitmex.com/realtime,
does anyone know how to solve the issue?
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.
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..?
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 :)
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.
๐
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.
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?
as a developer, I want to be able to sign on order live updates
TODO:
We should get real time margin stats especially available balance for trading. Wallet does not give information about balance.
I get BitmexApiException "Signature not valid" exception on all requests.
You have to provide Scheme to HttpRequestMessage.
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.
should_return_quotes
should_return_quotes_with_specific_count
should_return_quotes_bucketed
as a developer, I want to be able to sign on wallet updates
TODO:
Bitmex returns the following errors in response to overload and rate limit caps respectively:
https://www.bitmex.com/app/restAPI
Is there a way to propagate this information to the application, so it can handle them appropriately?
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.
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
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
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
As a developer, I should have access to the Chat information through the REST API /Chat, /Schema, /Settlement
https://github.com/BitMEX/api-connectors/tree/master/auto-generated/csharp
TODO:
uncomment fields under BitmexApiUrls.Chat, BitmexApiUrls.Schema, BitmexApiUrls.Settlement
fix dtos for the user API requests
add at least 1 integration test for each REST call
When you click on Buy or Sell, a window pops up with an error.
http://joxi.ru/1A5vDPptnR6vEr
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
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
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!
as a developer, I want to be able to sign on anouncements
TODO:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.