ExchangeSharp | REST and web sockets | Cryptography library
kandi X-RAY | ExchangeSharp Summary
kandi X-RAY | ExchangeSharp Summary
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 and chat with other developers.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ExchangeSharp
ExchangeSharp Key Features
ExchangeSharp Examples and Code Snippets
Community Discussions
Trending Discussions on ExchangeSharp
QUESTION
I created my fork https://github.com/jdx-john/ExchangeSharp in order to make changes, which I contributed upstream in a PR and were accepted.
I fetched-upstream on my fork in GitHub, but now it tells me my fork's master 'branch is 4 commits ahead of jjxtra:master' and I must make a PR. However as far as I can see, there are no changes... "showing 0 changed files"
I'm new to using forks (having used Git exclusively for feature branches on private projects) so I'm not sure if this is normal, or what I'm supposed to do about it as it seems messy. Did I do something wrong when making my PR?
...ANSWER
Answered 2021-Jun-21 at 21:08Your fork is ahead the mergecommits of upstream back to your master. Maybe they also "signed off"/cherry-picked / recommitted/squashed your work so it got another commit ID.
As your branch does not have newer content (empty diff, just mergecommits) you can forcepush to upstream/master-HEAD to have it clean again.
This is not intended, you probably messed something up. It shouldn't happen if you make your proposed changes in a feature branch only, and only ff-merge upstream/master to fork/master
QUESTION
I have read a few stackoverflow threads about multi-threading in a foreach loop, but I am not sure I am understanding and using it right.
I have tried multiple scenarios, but I am not seeing much increase in performance.
Here is what I believe runs Asynchronous tasks, but running synchronously in the loop using a single thread:
...ANSWER
Answered 2020-Apr-30 at 10:23In general, when you do not see an increase by multi threading, it is because your task is not CPU limited or large enough to offset the overhead.
In your example, i.e.:
selectedApi.GetTickerAsync(symbol);
This can hae 2 reasons:
1: Looking up the ticker is brutally fast and it should not be an async to start with. I.e. when you look it up in a dictionary.
2: This is running via a http connection where the runtime is LIMITING THE NUMBER OF CONCURRENT CALLS. Regardless how many tasks you open, it will not use more than 4 at the same time.
Oh, and 3: you think async is using threads. It is not. It is particularly not the case in a codel ike this:
await selectedApi.GetTickerAsync(symbol);
Where you basically IMMEDIATELY WAIT FOR THE RESULT. There is no multi threading involved here at all.
foreach (IExchangeAPI selectedApi in selectedApis) { if (exchangeSymbols.TryGetValue(selectedApi.Name, out symbol)) { ticker = await selectedApi.GetTickerAsync(symbol); } }
This is linear non threaded code using an async interface to not block the current thread while the (likely expensive IO) operation is in place. It starts one, THEN WAITS FOR THE RESULT. No 2 queries ever start at the same time.
If you want a possible (just as example) more scalable way:
- In the foreach, do not await but add the task to a list of tasks.
- Then start await once all the tasks have started. Likein a 2nd loop.
WAY not perfect, but at least the runtime has a CHANCE to do multiple lookups at the same time. Your await makes sure that you essentially run single threaded code, except async, so your thread goes back into the pool (and is not waiting for results), increasing your scalability - an item possibly not relevant in this case and definitely not measured in your test.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ExchangeSharp
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page