This repository was archived by the owner on Dec 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
112 lines (86 loc) · 4.15 KB
/
Program.cs
File metadata and controls
112 lines (86 loc) · 4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using CoinbasePro;
using CoinbasePro.Services.Accounts.Models;
using CoinbasePro.Shared.Types;
using NLog;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace BotTradingCoinbase
{
internal class Program
{
private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
private readonly static string passSandbox = "name";
private readonly static string apiKeySandbox = "apikey";
private readonly static string secretSandbox = "secret";
internal static string idUSDSandbox { get; } = "a1f7ea0a-948c-4c57-85da-33e197507750";
internal static string idLTCSandbox { get; } = "659d8b21-34af-44c8-b05f-596cb877ac3b";
internal static string idETHSandbox { get; } = "4a8b70e3-cb1c-4b66-9844-772abe1e6530";
internal static string idBTCSandbox { get; } = "a1d4e869-266e-4682-bda5-5c41dda6572b";
internal static string idEURSandbox { get; } = "e59bb5e1-8d58-4f01-98be-43e76f874be0";
private static string nomDuFichier = @"TestGDAX.txt";
private static int nombreAlgos = 0;
private static void PrepareNLog()
{
var config = new NLog.Config.LoggingConfiguration();
// Targets where to log to: File and Console
var logfile = new NLog.Targets.FileTarget("logfile") { FileName = nomDuFichier };
var logconsole = new NLog.Targets.ConsoleTarget("logconsole");
// Rules for mapping loggers to targets
config.AddRule(LogLevel.Debug, LogLevel.Fatal, logconsole);
config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile);
// Apply config
LogManager.Configuration = config;
}
private static async Task Main(string[] args)
{
PrepareNLog();
// File.Create(nomDuFichier).Close();
var authenticator = new CoinbasePro.Network.Authentication.Authenticator(apiKeySandbox,secretSandbox, passSandbox);
var coinbaseProClient = new CoinbaseProClient(authenticator, sandBox: true);
Pair pairBTCEUR = new Pair(coinbaseProClient, idBTCSandbox, idEURSandbox, ProductType.BtcEur);
Pair pairETHEUR = new Pair(coinbaseProClient, idETHSandbox, idEURSandbox, ProductType.EthEur);
Pair pairLTCEUR = new Pair(coinbaseProClient, idLTCSandbox, idEURSandbox, ProductType.LtcEur);
IEnumerable<Account> accounts;
accounts = await pairBTCEUR.ListerLesComptes();
//Task.Run(async () =>
//{
// await pair.ListerLesProduits();
//}).GetAwaiter().GetResult();
//Task.Run(async () =>
//{
// await pair.ListerLesMonnaies();
//}).GetAwaiter().GetResult();
//Task.Run(async () =>
//{
// await pair.DerniereCotation();
//}).GetAwaiter().GetResult();
Task.Run(async () =>
{
await pairBTCEUR.AvoirDuCompteCrypto();
}).GetAwaiter().GetResult();
Task.Run(async () =>
{
await pairBTCEUR.AvoirDuCompteFiat();
}).GetAwaiter().GetResult();
//Task.Run(async () =>
//{
// await pair.MinimumMonnaies();
//}).GetAwaiter().GetResult();
//Task.Run(async () =>
//{
// await pair.AnnulerTousOrdresOuverts();
//}).GetAwaiter().GetResult();
//AlgorithmeHaussierOrdreUnique alHETHEUR = new AlgorithmeHaussierOrdreUnique(pairETHEUR, 1000, 0.05m, 1.5m, ++nombreAlgos);
//await alHETHEUR.Initialiser();
//alHETHEUR.Lancer();
//AlgorithmeHaussierOrdreUnique alHLTCEUR = new AlgorithmeHaussierOrdreUnique(pairLTCEUR, 1000, 0.05m, 1.5m, ++nombreAlgos);
//await alHLTCEUR.Initialiser();
//alHLTCEUR.Lancer();
AlgorithmeHaussierOrdreUnique alHBTCEUR = new AlgorithmeHaussierOrdreUnique(pairBTCEUR, 3500, 0.05m, 1.5m, ++nombreAlgos);
await alHBTCEUR.Initialiser();
alHBTCEUR.Lancer();
Console.ReadKey();
}
}
}