Skip to content

Commit

Permalink
Merge pull request #18 from jhonabreul/refactor-subscription-validation
Browse files Browse the repository at this point in the history
Use Globals for credentials access for subscription validation
  • Loading branch information
jhonabreul authored Feb 21, 2024
2 parents 58a5f78 + d69e5e5 commit cb7b0ba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions QuantConnect.CoinbaseBrokerage/CoinbaseBrokerage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ protected void Initialize(string webSocketUrl, string apiKey, string apiSecret,
return;
}

ValidateSubscription();

Initialize(webSocketUrl, new WebSocketClientWrapper(), null, apiKey, apiSecret);

_job = job;
Expand All @@ -163,8 +165,6 @@ protected void Initialize(string webSocketUrl, string apiKey, string apiSecret,
SubscribeImpl = (symbols, _) => SubscribeSymbolsOnDataChannels(symbols.ToList()),
UnsubscribeImpl = (symbols, _) => Unsubscribe(symbols)
};

ValidateSubscription();
}

#region IBrokerage
Expand Down Expand Up @@ -416,10 +416,10 @@ private static void ValidateSubscription()
{
try
{
var productId = 183;
var userId = Config.GetInt("job-user-id");
var token = Config.Get("api-access-token");
var organizationId = Config.Get("job-organization-id", null);
const int productId = 183;
var userId = Globals.UserId;
var token = Globals.UserToken;
var organizationId = Globals.OrganizationID;
// Verify we can authenticate with this user and token
var api = new ApiConnection(userId, token);
if (!api.Connected)
Expand Down

0 comments on commit cb7b0ba

Please sign in to comment.