Skip to content

Commit 975dd93

Browse files
authored
chore: automated format (#814)
* Global formatting * Formatting with tabs and updating readme with links * Adding some settings and extension recs * undo the per exchange readme and move to a single src pointer
1 parent 8d5199f commit 975dd93

File tree

221 files changed

+28646
-19485
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+28646
-19485
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ root = true
22

33
[*.cs]
44
indent_style = tab
5-
indent_size = 4
5+
indent_size = 2
66
charset = utf-8
77
trim_trailing_whitespace = true
88
insert_final_newline = true

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"josefpihrt-vscode.roslynator",
4+
"ms-dotnettools.csharp"
5+
]
6+
}

.vscode/settings.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"activityBar.background": "#753ca1",
4+
"activityBar.foreground": "#ffffff",
5+
"activityBar.inactiveForeground": "#ffffff99",
6+
"activityBarBadge.background": "#d211fd",
7+
"activityBarBadge.foreground": "#ffffff",
8+
"statusBar.noFolderBackground": "#642596",
9+
"statusBar.background": "#753ca1",
10+
"statusBar.foreground": "#ffffff",
11+
"statusBarItem.hoverBackground": "#642596",
12+
"titleBar.activeBackground": "#753ca1",
13+
"titleBar.activeForeground": "#ffffff"
14+
},
15+
"[csharp]": {
16+
"editor.tabSize": 2,
17+
"editor.detectIndentation": false,
18+
"editor.insertSpaces": false,
19+
"editor.defaultFormatter": "ms-dotnettools.csharp"
20+
},
21+
"editor.renderWhitespace": "all"
22+
}

README.md

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,67 +6,67 @@
66

77
## Overview
88

9-
ExchangeSharp is a C# **framework/lib** and [console app](#Installing-the-CLI) for trading and communicating with [various](#Exchanges) exchange API end points for cryptocurrency assets. Many exchanges are supported, along with [web sockets](#Websockets), withdraws and more!
9+
ExchangeSharp is a C# **framework/lib** and [console app](#installing-the-cli) for trading and communicating with [various](#exchanges) exchange API end points for cryptocurrency assets. Many exchanges are supported, along with [web sockets](#websockets), withdraws and more!
1010

11-
Feel free to visit the discord channel at https://discord.gg/58ktxXuTVK and chat with other developers.
11+
Feel free to visit the discord channel at <https://discord.gg/58ktxXuTVK> and chat with other developers.
1212

1313
### Features
1414

15-
- Many exchanges supported with public, private and web socket API
15+
- Many [exchanges](/src//ExchangeSharp/API/Exchanges/) supported with public, private and web socket API
1616
- Easy to use code and API
1717
- Optional global market symbol normalization, since each exchange has their own way of doing market symbols
1818
- Runs anywhere .NET runs. (Windows, Mac, Linux, Containers, Serverless, iOS, Android, [etc.](https://docs.microsoft.com/en-us/dotnet/core/about))
1919
- Can be used from [many different C# platforms](https://github.com/dotnet/standard/blob/master/docs/versions/netstandard2.0.md#platform-support)
20-
- Has a great [CLI](#Installing-the-CLI) that enables you to use all features from all exchanges right from your command line.
20+
- Has a great [CLI](#installing-the-cli) that enables you to use all features from all exchanges right from your command line.
2121

2222
### Exchanges
2323

2424
The following cryptocurrency exchanges are supported:
2525
(Web socket key: T = tickers, R = trades, B = orderbook / delta orderbook, O = private orders, U = user data)
2626

27-
| Exchange Name | Public REST | Private REST | Web Socket | Notes |
28-
| -------------- | ----------- | ------------ | ---------- | ---------------------------------------- |
29-
| ApolloX | x | x | T R B O U |
30-
| Aquanow | wip | x | |
31-
| Binance | x | x | T R B O U |
32-
| Binance Jersey | x | x | T R B O U | Ceased operations
33-
| Binance.US | x | x | T R B O U |
34-
| Binance DEX | | | R |
35-
| Bitbank | x | x | |
36-
| Bitfinex | x | x | T R O |
37-
| Bitflyer | | | R |
38-
| Bithumb | x | | R |
39-
| BitMEX | x | x | R O |
40-
| Bitstamp | x | x | R |
41-
| Bittrex | x | x | T R |
42-
| BL3P | x | x | R B | Trades stream does not send trade's ids. |
43-
| Bleutrade | x | x | |
44-
| BtcTurk | | | R |
45-
| BTSE | x | x | |
46-
| Bybit | x | x | R | Has public method for Websocket Positions
47-
| Coinbase | x | x | T R O U |
48-
| Coincheck | | | R |
49-
| Coinmate | x | x | |
50-
| Crypto.com | | | R |
51-
| Digifinex | x | x | R B |
52-
| Dydx | | | R |
53-
| FTX | x | x | T R |
54-
| FTX.us | x | x | T R |
55-
| gate.io | x | x | R |
56-
| Gemini | x | x | T R B |
57-
| HitBTC | x | x | R |
58-
| Huobi | x | x | R B |
59-
| Kraken | x | x | R | Dark order symbols not supported |
60-
| KuCoin | x | x | T R |
61-
| LBank | x | x | R |
62-
| Livecoin | x | x | |
63-
| NDAX | x | x | T R |
64-
| OKCoin | x | x | R B |
65-
| OKEx | x | x | T R B O |
66-
| Poloniex | x | x | T R B |
67-
| UPbit | | | R |
68-
| YoBit | x | x | |
69-
| ZB.com | wip | | R |
27+
| Exchange Name | Public REST | Private REST | Web Socket | Notes |
28+
| ----------------------- | ----------- | ------------ | ------------- | ------------------------------------------- |
29+
| ApolloX | x | x | T R B O U | |
30+
| Aquanow | wip | x | | |
31+
| Binance | x | x | T R B O U | |
32+
| ~~Binance Jersey~~ | ~~x~~ | ~~x~~ | ~~T R B O U~~ | Ceased operations |
33+
| Binance.US | x | x | T R B O U | |
34+
| Binance DEX | | | R | |
35+
| Bitbank | x | x | | |
36+
| Bitfinex | x | x | T R O | |
37+
| Bitflyer | | | R | |
38+
| Bithumb | x | | R | |
39+
| BitMEX | x | x | R O | |
40+
| Bitstamp | x | x | R | |
41+
| Bittrex | x | x | T R | |
42+
| BL3P | x | x | R B | Trades stream does not send trade's ids. |
43+
| Bleutrade | x | x | | |
44+
| BtcTurk | | | R | |
45+
| BTSE | x | x | | |
46+
| Bybit | x | x | R | Has public method for Websocket Positions |
47+
| Coinbase (Pro) | x | x | T R O U | |
48+
| Coincheck | | | R | |
49+
| Coinmate | x | x | | |
50+
| Crypto.com | | | R | |
51+
| Digifinex | x | x | R B | |
52+
| Dydx | | | R | |
53+
| FTX | x | x | T R | |
54+
| FTX.us | x | x | T R | |
55+
| gate.io | x | x | R | |
56+
| Gemini | x | x | T R B | |
57+
| HitBTC | x | x | R | |
58+
| Huobi | x | x | R B | |
59+
| Kraken | x | x | R | Dark order symbols not supported |
60+
| KuCoin | x | x | T R | |
61+
| LBank | x | x | R | |
62+
| Livecoin | x | x | | |
63+
| NDAX | x | x | T R | |
64+
| OKCoin | x | x | R B | |
65+
| OKEx | x | x | T R B O | |
66+
| Poloniex | x | x | T R B | |
67+
| UPbit | | | R | |
68+
| YoBit | x | x | | |
69+
| ZB.com | wip | | R | |
7070

7171
The following cryptocurrency services are supported:
7272

@@ -169,7 +169,7 @@ Please read the [contributing guideline](CONTRIBUTING.md) **before** submitting
169169

170170
### Consulting
171171

172-
I'm happy to make customizations to the software for you and keep in private repo, email exchangesharp@digitalruby.com.
172+
I'm happy to make customizations to the software for you and keep in private repo, email <exchangesharp@digitalruby.com>.
173173

174174
### Donations Gratefully Accepted
175175

@@ -189,9 +189,8 @@ Donation totals:
189189
Thanks for visiting!
190190

191191
Jeff Johnson
192-
jeff@digitalruby.com
193-
http://www.digitalruby.com
192+
<jeff@digitalruby.com>
193+
<http://www.digitalruby.com>
194194

195195
[nuget]: https://www.nuget.org/packages/DigitalRuby.ExchangeSharp/
196196
[websocket4net]: https://github.com/kerryjiang/WebSocket4Net
197-

src/ExchangeSharp.Forms/Forms/PlotForm.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ExchangeSharp.Forms/Forms/PlotForm.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ public PlotForm()
8181
InitializeComponent();
8282
}
8383

84-
public void SetPlotPoints(List<List<KeyValuePair<float, float>>> points, List<KeyValuePair<float, float>> buyPrices = null, List<KeyValuePair<float, float>> sellPrices = null)
84+
public void SetPlotPoints(
85+
List<List<KeyValuePair<float, float>>> points,
86+
List<KeyValuePair<float, float>> buyPrices = null,
87+
List<KeyValuePair<float, float>> sellPrices = null
88+
)
8589
{
8690
// clear the chart
8791
PlotChart.Series.Clear();
@@ -152,10 +156,7 @@ public static class PlotFormExtensions
152156
{
153157
public static void ShowPlotForm(this Trader trader)
154158
{
155-
PlotForm form = new PlotForm
156-
{
157-
WindowState = FormWindowState.Maximized
158-
};
159+
PlotForm form = new PlotForm { WindowState = FormWindowState.Maximized };
159160
form.SetPlotPoints(trader.PlotPoints, trader.BuyPrices, trader.SellPrices);
160161
form.ShowDialog();
161162
}

src/ExchangeSharp/API/Common/APIException.cs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,24 @@ The above copyright notice and this permission notice shall be included in all c
1414

1515
namespace ExchangeSharp
1616
{
17-
/// <summary>
18-
/// Exception class for API calls
19-
/// </summary>
20-
public class APIException : Exception
21-
{
22-
/// <summary>
23-
/// Constructor
24-
/// </summary>
25-
/// <param name="message">Message</param>
26-
public APIException(string message) : base(message) { }
17+
/// <summary>
18+
/// Exception class for API calls
19+
/// </summary>
20+
public class APIException : Exception
21+
{
22+
/// <summary>
23+
/// Constructor
24+
/// </summary>
25+
/// <param name="message">Message</param>
26+
public APIException(string message)
27+
: base(message) { }
2728

28-
/// <summary>
29-
/// Constructor
30-
/// </summary>
31-
/// <param name="message"></param>
32-
/// <param name="innerException">Inner exception</param>
33-
public APIException(string message, Exception innerException) : base(message, innerException) { }
34-
}
35-
}
29+
/// <summary>
30+
/// Constructor
31+
/// </summary>
32+
/// <param name="message"></param>
33+
/// <param name="innerException">Inner exception</param>
34+
public APIException(string message, Exception innerException)
35+
: base(message, innerException) { }
36+
}
37+
}

src/ExchangeSharp/API/Common/APIRequestMaker.cs

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ public sealed class APIRequestMaker : IAPIRequestMaker
3737
public static IWebProxy? Proxy
3838
{
3939
get => ClientHandler.Proxy;
40-
set
41-
{
42-
ClientHandler.Proxy = value;
43-
}
40+
set { ClientHandler.Proxy = value; }
4441
}
4542
public static readonly HttpClient Client = new HttpClient(ClientHandler);
4643

@@ -105,7 +102,6 @@ public int ReadWriteTimeout
105102
set => Timeout = value;
106103
}
107104

108-
109105
public Task WriteAllAsync(byte[] data, int index, int length)
110106
{
111107
Request.Content = new ByteArrayContent(data, index, length);
@@ -139,7 +135,10 @@ public Dictionary<string, IReadOnlyList<string>> Headers
139135
{
140136
get
141137
{
142-
return response.Headers.ToDictionary(x => x.Key, x => (IReadOnlyList<string>)x.Value.ToArray());
138+
return response.Headers.ToDictionary(
139+
x => x.Key,
140+
x => (IReadOnlyList<string>)x.Value.ToArray()
141+
);
143142
}
144143
}
145144
}
@@ -162,7 +161,12 @@ public APIRequestMaker(IAPIRequestHandler api)
162161
/// The encoding of payload is API dependant but is typically json.</param>
163162
/// <param name="method">Request method or null for default. Example: 'GET' or 'POST'.</param>
164163
/// <returns>Raw response</returns>
165-
public async Task<IAPIRequestMaker.RequestResult<string>> MakeRequestAsync(string url, string? baseUrl = null, Dictionary<string, object>? payload = null, string? method = null)
164+
public async Task<IAPIRequestMaker.RequestResult<string>> MakeRequestAsync(
165+
string url,
166+
string? baseUrl = null,
167+
Dictionary<string, object>? payload = null,
168+
string? method = null
169+
)
166170
{
167171
await new SynchronizationContextRemover();
168172
await api.RateLimit.WaitToProceedAsync();
@@ -189,20 +193,29 @@ public APIRequestMaker(IAPIRequestHandler api)
189193
using var cancel = new CancellationTokenSource(request.Timeout);
190194
try
191195
{
192-
RequestStateChanged?.Invoke(this, RequestMakerState.Begin, uri.AbsoluteUri);// when start make a request we send the uri, this helps developers to track the http requests.
196+
RequestStateChanged?.Invoke(this, RequestMakerState.Begin, uri.AbsoluteUri); // when start make a request we send the uri, this helps developers to track the http requests.
193197
response = await Client.SendAsync(request.Request, cancel.Token);
194198
if (response == null)
195199
{
196200
throw new APIException("Unknown response from server");
197201
}
198202
responseString = await response.Content.ReadAsStringAsync();
199203

200-
if (response.StatusCode != HttpStatusCode.OK && response.StatusCode != HttpStatusCode.Created)
204+
if (
205+
response.StatusCode != HttpStatusCode.OK
206+
&& response.StatusCode != HttpStatusCode.Created
207+
)
201208
{
202209
// 404 maybe return empty responseString
203210
if (string.IsNullOrWhiteSpace(responseString))
204211
{
205-
throw new APIException(string.Format("{0} - {1}", response.StatusCode.ConvertInvariant<int>(), response.StatusCode));
212+
throw new APIException(
213+
string.Format(
214+
"{0} - {1}",
215+
response.StatusCode.ConvertInvariant<int>(),
216+
response.StatusCode
217+
)
218+
);
206219
}
207220

208221
throw new APIException(responseString);
@@ -225,12 +238,21 @@ public APIRequestMaker(IAPIRequestHandler api)
225238
{
226239
response?.Dispose();
227240
}
228-
return new IAPIRequestMaker.RequestResult<string>() { Response = responseString, HTTPHeaderDate = response.Headers.Date };
241+
return new IAPIRequestMaker.RequestResult<string>()
242+
{
243+
Response = responseString,
244+
HTTPHeaderDate = response.Headers.Date
245+
};
229246
}
230247

231248
/// <summary>
232249
/// An action to execute when a request has been made (this request and state and object (response or exception))
233250
/// </summary>
234-
public Action<IAPIRequestMaker, RequestMakerState, object>? RequestStateChanged { get; set; }
251+
public Action<
252+
IAPIRequestMaker,
253+
RequestMakerState,
254+
object
255+
>? RequestStateChanged
256+
{ get; set; }
235257
}
236258
}

0 commit comments

Comments
 (0)