Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

..hj #1

Open
wants to merge 393 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
393 commits
Select commit Hold shift + click to select a range
b716b1c
Update project files
sonvister Feb 20, 2018
5e5e1f9
Update sample applications
sonvister Feb 20, 2018
26017e8
Update 24-hour statistics sample
sonvister Feb 20, 2018
f28fff0
Update console app
sonvister Feb 20, 2018
1aeea21
Update market depth sample
sonvister Feb 20, 2018
6e846da
Update price chart sample
sonvister Feb 20, 2018
f8dcc6a
Update trade history sample
sonvister Feb 20, 2018
40cec7c
Update sample applications
sonvister Feb 20, 2018
a5c9cc5
Merge remote-tracking branch 'origin/master'
sonvister Feb 20, 2018
d9a253e
Update static assets and symbols
sonvister Feb 20, 2018
8775a04
Updates
sonvister Feb 21, 2018
c945e3e
ReSharper clean-up
sonvister Feb 22, 2018
85fe578
Update static assets and symbols
sonvister Feb 22, 2018
8326319
Updates
sonvister Feb 22, 2018
41004c0
Add BinanceWebSocketStreamController
sonvister Feb 22, 2018
00aeae6
Add architecture diagram
sonvister Feb 22, 2018
5379818
Update architecture.png
sonvister Feb 22, 2018
ae1fdca
Add HttpClientTimeoutDefaultSeconds option
sonvister Feb 22, 2018
3b33949
Add comments
sonvister Feb 22, 2018
e33e9ea
Update NuGet packages
sonvister Feb 23, 2018
2d3c237
Add unit tests
sonvister Feb 23, 2018
c1966df
Update architecture.png
sonvister Feb 23, 2018
53ccea0
Update versions
sonvister Feb 23, 2018
fb9c154
Add Asset and Symbol unit tests
sonvister Feb 23, 2018
4d4be52
Add InclusiveRange and TimeInterval unit tests
sonvister Feb 23, 2018
d402e56
Change IBinanceApi GetDeposits/GetWithdrawals timestamps to DateTime
sonvister Feb 23, 2018
923ae21
Remove IBinanceApi.GetAggregateTradesIn()
sonvister Feb 23, 2018
29ecf4a
Change IBinanceApi.GetCandlesticksAsync timestamps to DateTime
sonvister Feb 23, 2018
f7f7f66
Update sample applications
sonvister Feb 24, 2018
2cd5ef9
Update unit test
sonvister Feb 24, 2018
749f8c0
Update TaskController
sonvister Feb 24, 2018
50e161a
Have IJsonClient return self from Subscribe/Unsubscribe methods
sonvister Feb 24, 2018
9f2571b
Add trade client unit tests
sonvister Feb 24, 2018
cd22c29
Add depth client unit tests
sonvister Feb 24, 2018
61c6d81
Add candlestick client unit tests
sonvister Feb 24, 2018
d5845bd
Add symbol statistics client unit tests
sonvister Feb 24, 2018
8e06680
Add user data client unit tests
sonvister Feb 24, 2018
872e476
Update static assets and symbols
sonvister Feb 24, 2018
aaf85c4
Add trade history sample w/o using DI framework
sonvister Feb 25, 2018
3a0a405
Remove unused SingleUserDataClient
sonvister Feb 25, 2018
51c713c
Add argument exceptions
sonvister Feb 25, 2018
6a4d34c
Update versions
sonvister Feb 25, 2018
da1d0dd
Increase default watchdog timeout on UserDataClientManager
sonvister Feb 25, 2018
ae5cd3e
Change order rejected reason from enum to string
sonvister Feb 25, 2018
50da382
Remove task controller error callback (use error event instead)
sonvister Feb 25, 2018
df446b0
Update README.md
sonvister Feb 25, 2018
8decc4a
Merge remote-tracking branch 'origin/master'
sonvister Feb 25, 2018
72f9e41
Add pausing/resuming events to IRetryTaskController
sonvister Feb 25, 2018
fd9696e
Add logger and logging to task controllers
sonvister Feb 25, 2018
04c0195
Update README.md
sonvister Feb 25, 2018
ca2d027
Merge remote-tracking branch 'origin/master'
sonvister Feb 25, 2018
efa5321
FIX: BinanceWebSocketStream parsing of JSON array
sonvister Feb 26, 2018
1f12466
Add logging
sonvister Feb 26, 2018
65527f3
Update static assets and symbols
sonvister Feb 26, 2018
08b7a4e
Update cache unit tests
sonvister Feb 26, 2018
5d45ed4
Update integration tests
sonvister Feb 26, 2018
e00e622
Update/Add web socket client unit tests
sonvister Feb 26, 2018
293f4af
Add default web socket client unit tests
sonvister Feb 26, 2018
ec76278
Remove unused parameter
sonvister Feb 26, 2018
5e4102e
Update web socket client tests
sonvister Feb 26, 2018
66da572
Update file logger
sonvister Feb 26, 2018
671fd1d
Modify sample application log levels
sonvister Feb 26, 2018
cf64802
Add using on token registrations
sonvister Feb 26, 2018
14c9d5e
Add IWebSocketClient.IsOpen flag
sonvister Feb 26, 2018
409f9d7
Update comments
sonvister Feb 26, 2018
f3c6bb2
Update logging
sonvister Feb 27, 2018
9214f3b
Add IWebSocketClient extension to wait until web socket is open
sonvister Feb 27, 2018
8cd05fc
Update logging and comments
sonvister Feb 27, 2018
a535d73
Update example application
sonvister Feb 27, 2018
1912e4b
Update versions
sonvister Feb 27, 2018
5f23552
Return IJsonStream from subscribe/unsubscribe to allow chaining
sonvister Feb 27, 2018
b87c2f6
Update static assets and symbols
sonvister Feb 27, 2018
cb4a5ef
Update NuGet packages
sonvister Feb 27, 2018
712ea9c
Remove redundant field
sonvister Feb 27, 2018
1c75115
Replace IBinanceHttpClient.Options
sonvister Feb 27, 2018
ee9df97
Update versions
sonvister Feb 28, 2018
81410f8
Updates
sonvister Feb 28, 2018
9efffd6
Add ReadMe example
sonvister Feb 28, 2018
6cf2625
Update README.md
sonvister Feb 28, 2018
ec08c33
Merge remote-tracking branch 'origin/master'
sonvister Feb 28, 2018
132d52a
Add easier client order validation
sonvister Feb 28, 2018
189db61
Remove superficial sample applications
sonvister Feb 28, 2018
f112154
Add web socket cache managers
sonvister Feb 28, 2018
a656c59
Update README.md
sonvister Feb 28, 2018
2863d60
Update logging
sonvister Feb 28, 2018
a486a3c
Update README.md
sonvister Feb 28, 2018
02f5f6a
Update static assets and symbols
sonvister Feb 28, 2018
9797b32
Update README.md
sonvister Feb 28, 2018
146f152
Update README.md
sonvister Mar 1, 2018
8ac81d4
Move all controllers to Utility namespace
sonvister Mar 2, 2018
d0bb5fd
Update versions
sonvister Mar 2, 2018
010d36f
Add delay between queries when calculating average timestamp offset
sonvister Mar 2, 2018
f571baa
Update IWebSocketClient implementations
sonvister Mar 2, 2018
441094b
Update IWebSocketClient combined stream DI configuration
sonvister Mar 2, 2018
abc9156
Update README.md
sonvister Mar 2, 2018
4e5eb14
Update task controllers
sonvister Mar 2, 2018
cf70636
Add .travis.yml
sonvister Mar 3, 2018
bcf6de6
Update .travis.yml
sonvister Mar 3, 2018
c890aec
Update README.md
sonvister Mar 3, 2018
2fbc035
Update .travis.yml
sonvister Mar 3, 2018
dc535a1
Merge remote-tracking branch 'origin/master'
sonvister Mar 3, 2018
c844684
Fix use of watchdog timer
sonvister Mar 3, 2018
91066ac
Update unit tests
sonvister Mar 3, 2018
cc6131d
Refactoring: Create IJsonPublisher interface from IJsonStream
sonvister Mar 6, 2018
42dc337
Updates
sonvister Mar 6, 2018
b11ffd2
Add DefaultWebSocketClient unit tests
sonvister Mar 6, 2018
f87a15f
Add WebSocketStream and BinanceWebSocketStream unit tests
sonvister Mar 6, 2018
6f56d2d
Update BinanceWebSocketStream unit tests
sonvister Mar 6, 2018
c1cea69
Update README.md
sonvister Mar 6, 2018
b6de0f6
Remove IsAutoStreamingEnabled flag
sonvister Mar 6, 2018
29a8e0b
Simplify namespaces
sonvister Mar 6, 2018
d3554cb
Update architecture.png
sonvister Mar 7, 2018
c3b929e
Fix
sonvister Mar 7, 2018
47b0649
Update README.md
sonvister Mar 7, 2018
2f1f7f9
Update sample applications
sonvister Mar 7, 2018
fdfd4d9
ReSharper clean-up
sonvister Mar 7, 2018
a8bdd53
Update static assets and symbols
sonvister Mar 7, 2018
cf86967
Fix SymbolStatisticCache link to client and unsubscribe
sonvister Mar 7, 2018
1b8dd60
Update web socket client implementations
sonvister Mar 7, 2018
a40c6b4
Merge fix and unit test updates
sonvister Mar 7, 2018
da2967a
Update JsonStreamController
sonvister Mar 7, 2018
02c57d4
Update README.md
sonvister Mar 7, 2018
16f3878
Update architecture.png
sonvister Mar 7, 2018
813ae78
Change namespace Producer to Stream
sonvister Mar 8, 2018
52fb681
Make GetStreamName public static on clients
sonvister Mar 8, 2018
ea80e7a
Update versions
sonvister Mar 8, 2018
743211b
Fix cache subscribed streams
sonvister Mar 8, 2018
762329d
Update README.md
sonvister Mar 8, 2018
192c501
Updates
sonvister Mar 9, 2018
579de91
Fix publisher Unsubscribe() not triggering automatic stream control
sonvister Mar 9, 2018
d065ee8
Merge remote-tracking branch 'origin/master'
sonvister Mar 9, 2018
26c8ef9
Update versions
sonvister Mar 9, 2018
e9c148a
Update static assets and symbols
sonvister Mar 9, 2018
6794e30
Update README.md
sonvister Mar 10, 2018
ec6c575
Remove regions
sonvister Mar 12, 2018
4260cc8
Add JsonStreamPublisher unit tests
sonvister Mar 12, 2018
18f24bc
Update versions
sonvister Mar 13, 2018
61b2ead
Update BinanceUnknownStatusException
sonvister Mar 13, 2018
44ed87d
Update description
sonvister Mar 13, 2018
83df931
Fix CancelAllOrdersAsync
sonvister Mar 13, 2018
65ad7c2
BREAKING: Rename GetTradesAsync extension to GetAccountTradesAsync
sonvister Mar 13, 2018
76bd7d7
Update comments
sonvister Mar 13, 2018
5d61449
Update README.md
sonvister Mar 14, 2018
75ba9b7
Update README.md
sonvister Mar 16, 2018
7f7648c
Update README.md
sonvister Mar 16, 2018
9a08b21
Update README.md
sonvister Mar 16, 2018
537f3ff
Update README.md
sonvister Mar 16, 2018
4d33ed1
Update README.md
sonvister Mar 16, 2018
3aceb70
Update logo.png
sonvister Mar 16, 2018
abd6fb0
BREAKING: Remove ClientOrder.Time
sonvister Mar 17, 2018
75017d9
Add unit tests
sonvister Mar 17, 2018
aba54d4
Add IRateLimiterProvider and IApiRateLimiterProvider
sonvister Mar 17, 2018
65c130d
Add IBinanceApi.GetWithdrawFeeAsync()
sonvister Mar 17, 2018
a469e90
Update static assets and symbols
sonvister Mar 17, 2018
b6d26bb
Update versions
sonvister Mar 17, 2018
2fc4f81
Add "6h" candlestick interval conversion
sonvister Mar 27, 2018
62041e9
Update README.md
sonvister Mar 28, 2018
e657dc4
Update BinanceConsoleApp
sonvister Apr 3, 2018
b284780
Merge remote-tracking branch 'origin/master'
sonvister Apr 3, 2018
6bdeaa3
Set theme jekyll-theme-midnight
sonvister Apr 4, 2018
17ef83c
Set theme jekyll-theme-cayman
sonvister Apr 4, 2018
c813dd8
Delete _config.yml
sonvister Apr 4, 2018
5155e6f
Merge remote-tracking branch 'origin/master'
sonvister Apr 4, 2018
fc1daae
Update NuGet dependencies
sonvister Apr 4, 2018
5930094
Temporarily remove Candlestick volume < 0 check
sonvister Apr 4, 2018
fe257be
Update versions
sonvister Apr 4, 2018
39be3d5
Update unit test
sonvister Apr 4, 2018
69f413e
Update static assets and symbols
sonvister Apr 4, 2018
428c07c
Update versions
sonvister Apr 6, 2018
a7277db
Add string interning to assets and symbols
sonvister Apr 6, 2018
4d6033e
Remove redundant string literal interning
sonvister Apr 7, 2018
f0e3a98
Fix for #86
sonvister Apr 23, 2018
a2d4362
Update static assets and symbols
sonvister Apr 23, 2018
423e93b
BREAKING: Replace string to Symbol implicit conversion with Symbol.Get()
sonvister May 1, 2018
7b936e2
BREAKING: Abstract Symbol/Asset Cache and redirect static definitions
sonvister May 2, 2018
571f862
Move new Asset and Symbol caches to Cache namespace
sonvister May 3, 2018
e9c364c
Refactor asset and symbol cache implementations
sonvister May 4, 2018
74502b1
Fixes #91
sonvister May 8, 2018
01792f0
Update versions
sonvister May 11, 2018
f8678fd
Change Symbol.Cache keys to match symbol.ToString() values
sonvister May 11, 2018
6bed8c1
For #96
sonvister Jun 2, 2018
b0c8f02
Update README.md
sonvister Jul 15, 2018
471abbe
Update ReadMeExample.cs
sonvister Jul 15, 2018
419a80a
Update versions
sonvister Sep 25, 2018
c5f06bb
Migrate sample apps from .NET Core 2.0 to 2.1
sonvister Sep 25, 2018
f36d597
Migrate test and tool apps from .NET Core 2.0 to 2.1
sonvister Sep 25, 2018
be5e8ba
Add decimal normalization extension
sonvister Sep 25, 2018
fad60f9
Update apps
sonvister Sep 25, 2018
34e1771
Update static assets and symbols
sonvister Sep 25, 2018
0350067
Update .travis.yml
sonvister Sep 25, 2018
79df3b0
Update .travis.yml
sonvister Sep 25, 2018
67beb00
Update .travis.yml
sonvister Sep 25, 2018
e1e0427
Update .travis.yml
sonvister Sep 25, 2018
06e4a8c
Update .travis.yml
sonvister Sep 25, 2018
79b5f84
Update unit test
sonvister Sep 25, 2018
b91b33f
Update versions
sonvister Sep 28, 2018
2390193
Add ThrowIfDisposed() to BinanceHttpClient
sonvister Sep 28, 2018
88b3268
Allow for non-static usage of ServiceProvider
sonvister Sep 28, 2018
4f5afe0
Update static assets and symbols
sonvister Sep 29, 2018
1d94ad4
Update versions
sonvister Nov 18, 2018
12d5bb9
Remove BCH Asset and Symbol redirections
sonvister Nov 18, 2018
5db0929
Remove BCH Asset and Symbol redirects
sonvister Nov 18, 2018
a4de992
Merge remote-tracking branch 'origin/master'
sonvister Nov 18, 2018
a296e58
Update versions
sonvister Nov 28, 2018
c7b852e
Improve WAPI error message handling
sonvister Nov 28, 2018
d2899a2
Add RateLimitInfo.IntervalNum property
sonvister Dec 3, 2018
a06e1a3
Update rate limiter weights
sonvister Dec 3, 2018
4061dfa
Handle all HTTP 5xx errors as UNKNOWN status
sonvister Dec 3, 2018
87df9d9
Add Order.UpdateTime property
sonvister Dec 3, 2018
5e01d13
Add start/end time to get orders API method
sonvister Dec 3, 2018
3c025ee
Add start/end time to get account trades API method
sonvister Dec 3, 2018
d40d96f
Add Order.CummulativeQuoteAssetQuantity property
sonvister Dec 4, 2018
f078175
Add symbol average price API method: GetAvgPriceAsync
sonvister Dec 4, 2018
fd7d4e6
Add integration test console app command
sonvister Dec 4, 2018
6df97f5
Add Dust Log, Trade Fee, and Asset Detail HTTP client extensions
sonvister Dec 4, 2018
c793f57
Update unit test
sonvister Dec 4, 2018
6938996
Update symbol price validation for new "PERCENT_PRICE" filter
sonvister Dec 5, 2018
109c396
Updates
sonvister Dec 5, 2018
ca74729
Change project description
sonvister Dec 6, 2018
22e8de8
Update unit test
sonvister Dec 6, 2018
a2070b2
Update static assets and symbols
sonvister Dec 7, 2018
aeb6a5b
Update NuGet library references
sonvister Dec 7, 2018
9820c97
Update versions
sonvister Dec 8, 2018
1856168
Console sample application updates
sonvister Dec 8, 2018
55f321e
Improve HTTP client error handling
sonvister Dec 8, 2018
99a8afc
Update sample application logging
sonvister Dec 8, 2018
53b3dd9
Move extensions to their respective namespace folders
sonvister Dec 8, 2018
515af6b
Move some low-level API components to Binance.Api namespace
sonvister Dec 8, 2018
c694316
Move some low-level API components to Binance.Api namespace
sonvister Dec 8, 2018
1369064
Merge remote-tracking branch 'origin/master'
sonvister Dec 8, 2018
503f394
Update README.md
sonvister Jan 19, 2019
602e178
Update README.md
sonvister Jan 19, 2019
758e5db
Update README.md
sonvister Jan 22, 2019
f822a7e
Remove unused class and tests
sonvister Jan 25, 2019
d008539
Fix comment
sonvister Jan 25, 2019
963c64b
Update README.md
sonvister Mar 9, 2019
deec859
Closes #119
sonvister Mar 9, 2019
fb2c568
Update static assets and symbols
sonvister Mar 9, 2019
8fa3ba1
Update package copyright and description
sonvister Mar 9, 2019
99098fe
Update versions
sonvister Mar 9, 2019
dd7aade
Add quote quantity to account trade
sonvister Apr 11, 2019
865277e
Fix unit test
sonvister Apr 11, 2019
3c79afc
Update versions
sonvister Apr 11, 2019
ee94d41
Move endpoint URL to API options
sonvister Sep 20, 2019
f462d13
Update console application to use new endpoint URL configuration
sonvister Sep 20, 2019
a2676dd
Update order rate limit count default
sonvister Sep 20, 2019
41891be
Add order book limit 5000 and 10000 rate limits
sonvister Sep 20, 2019
c1dd7a5
Update static assets and symbols
sonvister Sep 20, 2019
4124e09
Update README.md
sonvister Jan 13, 2020
f3d5751
Update README.md
sonvister Jan 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: csharp
mono: none
dotnet: 2.1
script:
- dotnet build src/Binance --framework "netstandard2.0"
- dotnet test test/Binance.Tests

25 changes: 2 additions & 23 deletions Binance.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2024
VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{8871736C-4CDB-47C5-B73A-BED3CA46164A}"
EndProject
Expand Down Expand Up @@ -32,13 +32,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{4D701143
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Binance24HourStatistics", "samples\Binance24HourStatistics\Binance24HourStatistics.csproj", "{DF3370A6-FB19-4160-B46C-4EAAAFB510AD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BinanceClassicConsoleApp", "samples\BinanceClassicConsoleApp\BinanceClassicConsoleApp.csproj", "{BC43C0B3-1EF1-458E-9A97-B9A4FD9FE5F9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BinanceWebApp", "samples\BinanceWebApp\BinanceWebApp.csproj", "{A9FA64FF-B0CF-4B5B-8AC9-2491F11747EE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BinanceClassicWebApp", "samples\BinanceClassicWebApp\BinanceClassicWebApp.csproj", "{6C70F1C4-86BE-40E0-9B9A-6F5373E21F28}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Binance.WebSocket.WebSocketSharp", "samples\Binance.WebSocket.WebSocketSharp\Binance.WebSocket.WebSocketSharp.csproj", "{FE699962-ABF9-4BD9-B27A-DA242D6C7F11}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Binance.WebSocket.WebSocketSharp", "samples\Binance.WebSocket.WebSocketSharp\Binance.WebSocket.WebSocketSharp.csproj", "{FE699962-ABF9-4BD9-B27A-DA242D6C7F11}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Binance.WebSocket.WebSocket4Net", "samples\Binance.WebSocket.WebSocket4Net\Binance.WebSocket.WebSocket4Net.csproj", "{67C1BE38-527F-424D-85A6-DFD8117E21D1}"
EndProject
Expand Down Expand Up @@ -84,18 +78,6 @@ Global
{DF3370A6-FB19-4160-B46C-4EAAAFB510AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF3370A6-FB19-4160-B46C-4EAAAFB510AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF3370A6-FB19-4160-B46C-4EAAAFB510AD}.Release|Any CPU.Build.0 = Release|Any CPU
{BC43C0B3-1EF1-458E-9A97-B9A4FD9FE5F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC43C0B3-1EF1-458E-9A97-B9A4FD9FE5F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC43C0B3-1EF1-458E-9A97-B9A4FD9FE5F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC43C0B3-1EF1-458E-9A97-B9A4FD9FE5F9}.Release|Any CPU.Build.0 = Release|Any CPU
{A9FA64FF-B0CF-4B5B-8AC9-2491F11747EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A9FA64FF-B0CF-4B5B-8AC9-2491F11747EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9FA64FF-B0CF-4B5B-8AC9-2491F11747EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9FA64FF-B0CF-4B5B-8AC9-2491F11747EE}.Release|Any CPU.Build.0 = Release|Any CPU
{6C70F1C4-86BE-40E0-9B9A-6F5373E21F28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C70F1C4-86BE-40E0-9B9A-6F5373E21F28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C70F1C4-86BE-40E0-9B9A-6F5373E21F28}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C70F1C4-86BE-40E0-9B9A-6F5373E21F28}.Release|Any CPU.Build.0 = Release|Any CPU
{FE699962-ABF9-4BD9-B27A-DA242D6C7F11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE699962-ABF9-4BD9-B27A-DA242D6C7F11}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE699962-ABF9-4BD9-B27A-DA242D6C7F11}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -117,9 +99,6 @@ Global
{6B373EAC-2ADD-49BB-B2FC-01A873DF752B} = {8871736C-4CDB-47C5-B73A-BED3CA46164A}
{D4767C0E-FDF3-43E0-8E3C-D29D6FC0A667} = {4D701143-0BA1-49BB-9838-AC64DA88FBD7}
{DF3370A6-FB19-4160-B46C-4EAAAFB510AD} = {8871736C-4CDB-47C5-B73A-BED3CA46164A}
{BC43C0B3-1EF1-458E-9A97-B9A4FD9FE5F9} = {8871736C-4CDB-47C5-B73A-BED3CA46164A}
{A9FA64FF-B0CF-4B5B-8AC9-2491F11747EE} = {8871736C-4CDB-47C5-B73A-BED3CA46164A}
{6C70F1C4-86BE-40E0-9B9A-6F5373E21F28} = {8871736C-4CDB-47C5-B73A-BED3CA46164A}
{FE699962-ABF9-4BD9-B27A-DA242D6C7F11} = {8871736C-4CDB-47C5-B73A-BED3CA46164A}
{67C1BE38-527F-424D-85A6-DFD8117E21D1} = {8871736C-4CDB-47C5-B73A-BED3CA46164A}
EndGlobalSection
Expand Down
172 changes: 146 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
# Binance ![](https://github.com/sonvister/Binance/blob/master/images/logo.png?raw=true)
A full-featured .NET **[Binance API](https://www.binance.com/restapipub.html)** designed for ease of use.
A .NET API library (a.k.a. wrapper) for the **[official Binance web API](https://github.com/binance-exchange/binance-official-api-docs)**.

Compatible with **.NET Standard 2.0** and **.NET Framework 4.7.1**

Built using [TAP (Task-based Asynchronous Pattern)](https://docs.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/task-based-asynchronous-pattern-tap).

[![](https://img.shields.io/github/last-commit/sonvister/Binance.svg)](https://github.com/sonvister/Binance)

## Features
* Compatible with **.NET Standard 2.0** and **.NET Framework 4.7.1**.
* **Complete** coverage of the [Binance API](https://www.binance.com/restapipub.html) including all REST and WebSocket endpoints (*with combined streams*).
* A Binance account API Key is *not required* to access *public* REST and WebSocket endpoints (*most market data*).
* **Simple** API abstraction using domain/value objects that do not expose underlying (*HTTP/REST*) behavior.
* **Beta** release with majority coverage of the official [Binance API](https://github.com/binance-exchange/binance-official-api-docs) including REST API and Web Sockets.
* *NOTE: Not actively adding new features or providing support...*
* Binance account API-Key is *not required* to access the *public* REST and Web Socket endpoints (*most market data*).
* Easy-to-use **Web Socket managers** (*with combined streams*) and **in-memory cache** implementations (*with events*).
* **Convenient** assets and symbols (e.g. `Symbol.BTC_USDT`) with exchange info (*price/quantity: min, max, etc.*).
* With methods for validating (*w/ or w/o exceptions*) client order price, quantity, and type for a symbol.
* Consistent use of **domain models** whether you're querying the API or using real-time WebSocket client events.
* Customizable **dual-layer API** with access to JSON responses (*low-level*) or deserialized domain/value objects.
* Same serializers used in `BinanceApi` are available to provide application-level deserialization of JSON data.
* API exceptions provide the Binance server response **ERROR code and message** for easier troubleshooting.
* Unique implementation supports **multiple users** and requires user authentication only where necessary.
* Web API interface includes automatic **rate limiting** and system-to-server **time synchronization** for reliability.
* REST API includes automatic **rate limiting** and system-to-server **time synchronization** for reliability.
* Advanced rate limiting includes distinct (request and order) rate limiters with **endpoint weights** incorporated.
* Easy-to-use **WebSocket endpoint clients** and various ready-to-use **caching** implementations (*with events*).
* Low-level `BinanceHttpClient` API utilizes a single, cached HttpClient for performance (*and implemented as singleton*).
* **Limited dependencies** and use of Microsoft extensions for **dependency injection**, **logging**, and **options**.
* Unique REST API implementation supports **multiple users** and requires user authentication only where necessary.
* REST API exceptions provide the Binance server response **ERROR code and message** for easier troubleshooting.
* REST API (*low-level*) utilizes a single, cached `HttpClient` for performance (*implemented as singleton*).
* **Simple** API abstraction using domain/value objects that do not expose underlying (*HTTP/REST*) behavior.
* Consistent use of **domain models** between REST API queries and real-time Web Socket client events.
* Customizable **multi-layer API** with access to (*low-level*) JSON responses or deserialized domain/value objects.
* Same serializers used in `BinanceApi` are available for application-level deserialization of JSON data.
* **Limited dependencies** with use of Microsoft extensions for **dependency injection**, **logging**, and **options**.
* Multiple .NET **sample applications** including live displays of market depth, trades, and candlesticks for a symbol.
* Alternative `IWebSocketClients` for using **WebSocketSharp** or **WebSocket4Net** (*for Windows 7 compatibility*).
* How to **efficiently** use combined streams with a single, application-wide, web socket (`BinanceWebSocketStream`).

## Getting Started
### Binance Sign-up
To use the private (*authenticated*) API methods you must have an account with Binance and create an API Key. Please use my Referral ID: **10899093** when you [**Register**](https://www.binance.com/register.html?ref=10899093) (*an account is not required to access the public market data*).
To use the private (*authenticated*) API methods you must have an account with Binance and create an API-Key. Please use my Referral ID: **10899093** when you [**Register**](https://www.binance.com/register.html?ref=10899093) (*it's an easy way to give back at no cost to you*).

*NOTE*: An account is *not* required to access the public market data.

### Installation
Using [Nuget](https://www.nuget.org/packages/Binance/) Package Manager:
Expand All @@ -36,25 +42,139 @@ PM> Install-Package Binance
[![](https://img.shields.io/nuget/v/Binance.svg)](https://www.nuget.org/packages/Binance)\
[![](https://img.shields.io/nuget/dt/Binance.svg)](https://www.nuget.org/packages/Binance)

### Example Usage
#### REST API
Test connectivity.

```C#
using Binance;

// Initialize REST API client.
var api = new BinanceApi();

// Check connectivity.
if (await api.PingAsync())
{
Console.WriteLine("Successful!");
}
```

Place a TEST market order.

```C#
using Binance;

var api = new BinanceApi();

// Create user with API-Key and API-Secret.
using (var user = new BinanceApiUser("<API-Key>", "<API-Secret>"))
{
// Create a client (MARKET) order.
var clientOrder = new MarketOrder(user)
{
Symbol = Symbol.BTC_USDT,
Side = OrderSide.Buy,
Quantity = 0.01m
};

try
{
// Send the TEST order.
await api.TestPlaceAsync(clientOrder);

Console.WriteLine("TEST Order Successful!");
}
catch (Exception e)
{
Console.WriteLine($"TEST Order Failed: \"{e.Message}\"");
}
}
```

#### Web Socket
Get real-time aggregate trades (*with automatic web socket re-connect*).

```C#
using Binance;
using Binance.WebSocket;

// Initialize web socket client (with automatic streaming).
var webSocketClient = new AggregateTradeWebSocketClient();

// Handle error events.
webSocketClient.Error += (s, e) => { Console.WriteLine(e.Exception.Message); };

// Subscribe callback to BTC/USDT (automatically begin streaming).
webSocketClient.Subscribe(Symbol.BTC_USDT, evt =>
{
var side = evt.Trade.IsBuyerMaker ? "SELL" : "BUY ";

// Handle aggregate trade events.
Console.WriteLine($"{evt.Trade.Symbol} {side} {evt.Trade.Quantity} @ {evt.Trade.Price}");
});

// ...

// Unsubscribe (automatically end streaming).
webSocketClient.Unsubscribe();
```

Maintain real-time order book (market depth) cache.

```C#
using Binance;
using Binance.Cache;
using Binance.WebSocket;

// Initialize web socket cache (with automatic streaming).
var webSocketCache = new DepthWebSocketCache();

// Handle error events.
webSocketCache.Error += (s, e) => { Console.WriteLine(e.Exception.Message); };

// Subscribe callback to BTC/USDT (automatically begin streaming).
webSocketCache.Subscribe(Symbol.BTC_USDT, evt =>
{
// Get symbol from cache (update cache if a symbol is missing).
var symbol = Symbol.Cache.Get(evt.OrderBook.Symbol);

var minBidPrice = evt.OrderBook.Bids.Last().Price;
var maxAskPrice = evt.OrderBook.Asks.Last().Price;

// Handle order book update events.
Console.WriteLine($"Bid Quantity: {evt.OrderBook.Depth(minBidPrice)} {symbol.BaseAsset} - " +
$"Ask Quantity: {evt.OrderBook.Depth(maxAskPrice)} {symbol.BaseAsset}");
});

// ...

// Unsubscribe (automatically end streaming).
webSocketCache.Unsubscribe();
```

## Documentation
See: [**Wiki**](https://github.com/sonvister/Binance/wiki)

***NOTE**: The [samples](https://github.com/sonvister/Binance/blob/master/samples) demonstrate up-to-date usage of this library.*

### Binance Exchange API (*for reference*)
REST/WebSocket details: [Binance Official Documentation](https://github.com/binance-exchange/binance-official-api-docs)\
REST/WebSocket questions: [Binance Official API Telegram](https://t.me/binance_api_english) (*not for questions about this library*)

## Development
The master branch is *currently* used for development and may differ from the latest release.\
To get the source code for a particular release, first select the corresponding **Tag**.

### Build Environment
[Microsoft Visual Studio Community 2017](https://www.visualstudio.com/vs/community/)

## Documentation
See [**Wiki**](https://github.com/sonvister/Binance/wiki)

*NOTE: Some information is currently out-of-date ...will be updated soon.*
![Build status](https://travis-ci.org/sonvister/Binance.svg?branch=master)

## Donate
DCR: Dsog2jYLS65Y3N2jDQSxsiBYC3SRqq7TGd4\
LTC: MNhGkftcFDE7TsFFvtE6W9VVKhxH74T3eM\
XEM: NC3HR4-V46BTS-LIKEE4-2GZQBB-FHBUXO-CG7EBO-VIMP\
DASH: XmFvpRgwfDRdN9wbrZjHZeH63Rt9CwHqUf\
ZEC: t1Ygz58dkcx2WXuGCjGiPo8w7Q1dcCSscGJ\
ETH: 0x3BFd7B3EAA6aE6BCF861B9B1803d67abe9360bca\
BTC: 3JjG3tRR1dx98UJyNdpzpkrxRjXmPfQHk9
**Decred (DCR)**: Dsd7amDBfC7n6G93NJzbaJjUdiSeN5D3tmR

Thank you.

Follow [@sonvister](https://twitter.com/sonvister)

[![Donate NIM](https://www.nimiq.com/accept-donations/img/donationBtnImg/orange-small.svg)](https://safe.nimiq.com/#_request/NQ13481VT3VVKRENJJL39B5J7DJMHF4CRCVL_)
Binary file added images/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion samples/Binance.Application/Binance.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// ReSharper disable once CheckNamespace
namespace Binance.Application
{
public static class LoggerFactoryExtensions
public static class LoggingBuilderExtensions
{
public static ILoggerFactory AddFile(this ILoggerFactory factory, IConfiguration configuration)
public static ILoggingBuilder AddFile(this ILoggingBuilder builder, IConfiguration configuration)
{
if (configuration == null)
throw new ArgumentNullException(nameof(configuration));
Expand Down Expand Up @@ -37,20 +37,20 @@ public static ILoggerFactory AddFile(this ILoggerFactory factory, IConfiguration
}
}

return AddFile(factory, filePath, level);
return AddFile(builder, filePath, level);
}

public static ILoggerFactory AddFile(this ILoggerFactory factory, string filePath, LogLevel level = LogLevel.Information)
public static ILoggingBuilder AddFile(this ILoggingBuilder builder, string filePath, LogLevel level = LogLevel.Information)
{
if (factory == null)
throw new ArgumentNullException(nameof(factory), $"{nameof(ILoggerFactory)} is null (add Microsoft.Extensions.Logging NuGet package).");
if (builder == null)
throw new ArgumentNullException(nameof(builder), $"{nameof(ILoggerFactory)} is null (add Microsoft.Extensions.Logging NuGet package).");

if (filePath == null)
throw new ArgumentNullException(nameof(filePath));

factory.AddProvider(new FileLoggerProvider(filePath, level));
builder.AddProvider(new FileLoggerProvider(filePath, level));

return factory;
return builder;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.IO;
using System.Linq;
using System.Text;
using Binance.Market;

// ReSharper disable once CheckNamespace
namespace Binance.Application
Expand Down
11 changes: 8 additions & 3 deletions samples/Binance.Application/Logging/FileLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public sealed class FileLogger : ILogger
{
#region Private Constants

private const string Spaces = " ";
private const string Spaces = " ";

#endregion Private Constants

Expand Down Expand Up @@ -78,9 +78,14 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
streamWriter.WriteLine($"{Spaces}{line}");
}

if (exception != null)
var prefix = string.Empty;

while (exception != null)
{
streamWriter.WriteLine($"{Spaces}(exception: \"{exception.Message}\")");
streamWriter.WriteLine($"{Spaces}{prefix}(exception: \"{exception.Message}\")");

prefix += " ";
exception = exception.InnerException;
}

streamWriter.Flush();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>0.1.1</Version>
<AssemblyVersion>0.1.1.0</AssemblyVersion>
<FileVersion>0.1.1.0</FileVersion>
<Version>0.2.0</Version>
<AssemblyVersion>0.2.0.1</AssemblyVersion>
<FileVersion>0.2.0.1</FileVersion>
<Authors>sonvister</Authors>
<Company />
<Copyright>Copyright © 2018 sonvister</Copyright>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.0.0" />
<PackageReference Include="WebSocket4Net" Version="0.15.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.2.0" />
<PackageReference Include="WebSocket4Net" Version="0.15.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading