Skip to content

Commit

Permalink
v1.2.0 Blueberry
Browse files Browse the repository at this point in the history
- Add error exit codes
- Add the possibility to ignore some assets
- Add the possibility to stop the program if the timestamp is off
- Change the method of time synchronisation from a powershell script to a native method

Don't ask me why the commit name is blueberry, it just popped in my head
  • Loading branch information
MonsterPoney committed Mar 11, 2023
1 parent 1d6abf0 commit b907962
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 88 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Switch 'UseBinance' to true.

### Bybit
Acquire Bybit API key in your profile > API
In the "API key permissions" section, check "Read-Only" and check the permission "Trade"
In the "API key permissions" section, check "Read-Only" and check the permission "Trade" for SPOT
You can also restrict the access to one or multiple IPs.

![Bybit API config](https://user-images.githubusercontent.com/25821500/154150876-78eb9950-defe-4912-b8d1-c521002e5e96.JPG)
Expand Down Expand Up @@ -65,13 +65,25 @@ No data is sent on an external source, everything is on your computer in the pro
- Error "database is locked"
This happen when a connection to the db file is already openned

- Error code -1021 "Timestamp for this request was 1000ms ahead of the server's time."
- Error code 1398 or -1021 "Timestamp for this request was 1000ms ahead of the server's time."
Your system clock might be (at least slightly) off, try resync the system clock of your computer in the Date and time settings.
~~The program will attempt to do it if you set the 'AutoTimeSync' to 'true'.~~
The program will attempt to do it if you set the 'AutoTimeSync' to 'true'.

- Error when reading the 'xxxx' option
If you build the source code, visual studio encode the config file with a Byte Of Mark (UTF-8-BOM).
Change the encoding to UTF-8 with notepad++ or other text editor.

- Error code 1610
Check the config.ini file, there must be a missing parameter like a boolean.

- Error code 1065
Error with the database, the log should give an explanation

- Error code 259
No asset was recovered, make sure you use at least one API in the config file.

- Error code 574
It's the global error, ( ._.) That's annoying but the log file should help.

## Donations
I developped this program on my spare time, if you want to support me you can donate at theses adresses :
Expand Down
6 changes: 6 additions & 0 deletions Spot Wallets Report Generator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spot Wallets Report Generator", "Spot Wallets Report Generator\Spot Wallets Report Generator.csproj", "{22E7F036-C9F8-4413-A68A-D34FB1A26BE8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wallets History Explorer", "Wallets History Explorer\Wallets History Explorer.csproj", "{60287B1C-3CFF-43D4-9C57-7B5D32B59FB9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,6 +17,10 @@ Global
{22E7F036-C9F8-4413-A68A-D34FB1A26BE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22E7F036-C9F8-4413-A68A-D34FB1A26BE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22E7F036-C9F8-4413-A68A-D34FB1A26BE8}.Release|Any CPU.Build.0 = Release|Any CPU
{60287B1C-3CFF-43D4-9C57-7B5D32B59FB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60287B1C-3CFF-43D4-9C57-7B5D32B59FB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60287B1C-3CFF-43D4-9C57-7B5D32B59FB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60287B1C-3CFF-43D4-9C57-7B5D32B59FB9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
8 changes: 5 additions & 3 deletions Spot Wallets Report Generator/APIcalls/BinanceCalls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,11 @@ public static List<Balance> GetWallet() {
}
}
} else {
dynamic json = Json.Decode(response.Content.ReadAsStringAsync().Result);
Program.WriteLog($"Error BinanceCalls.GetWallet() => error code : {json.code}\r\nMessage : {json.msg}\r\n");
dynamic json = Json.Decode(response.Content.ReadAsStringAsync().Result);
Program.WriteLog($"Error BinanceCalls.GetWallet() => error code : {json.code}\r\nMessage : {json.msg}");
Program.error = true;
if (json.code == -1021 && Program.stopIfBadTimeStamp)
Environment.Exit(1398);
}

}
Expand All @@ -173,7 +175,7 @@ public static float GetAveragePrice(string symbol) {
price = float.Parse(json.price.Replace('.', ','));
} else if ((int)response.StatusCode == 429) {
Program.WriteLog("Breaking Binance API rate limit.");
Environment.Exit(1);
Environment.Exit(58);
} else {
dynamic json = Json.Decode(response.Content.ReadAsStringAsync().Result);
if (json.code != -1121) {
Expand Down
2 changes: 2 additions & 0 deletions Spot Wallets Report Generator/APIcalls/BybitCalls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public static List<Balance> GetWallet() {
}
} else {
Program.WriteLog($"Error BybitCalls.GetWallet(), code {json.ret_code} : {json.ret_msg}");
if (json.ret_code == -1021 && Program.stopIfBadTimeStamp)
Environment.Exit(1398);
Program.error = true;
}
} else {
Expand Down
Loading

0 comments on commit b907962

Please sign in to comment.