Skip to content

Commit

Permalink
Gateways
Browse files Browse the repository at this point in the history
  • Loading branch information
artemiusgreat committed Nov 17, 2024
1 parent eb847f8 commit 3210ae0
Show file tree
Hide file tree
Showing 28 changed files with 493 additions and 613 deletions.
4 changes: 2 additions & 2 deletions Core/Domains/Gateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public interface IGateway : IDisposable
/// <param name="screener"></param>
/// <param name="criteria"></param>
/// <returns></returns>
Task<ResponseModel<DomModel>> GetDom(DomScreenerModel screener, Hashtable criteria);
Task<ResponseModel<DomModel>> GetDom(PointScreenerModel screener, Hashtable criteria);

/// <summary>
/// Get historical bars
Expand Down Expand Up @@ -175,7 +175,7 @@ public Gateway()
/// <param name="args"></param>
/// <param name="criteria"></param>
/// <returns></returns>
public abstract Task<ResponseModel<DomModel>> GetDom(DomScreenerModel args, Hashtable criteria);
public abstract Task<ResponseModel<DomModel>> GetDom(PointScreenerModel args, Hashtable criteria);

/// <summary>
/// Get historical bars
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion Core/Enums/StatusEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public enum StatusEnum : byte
{
None = 0,
Error = 1,
Success = 2
Success = 2,
Progress = 3
}
}
10 changes: 10 additions & 0 deletions Core/Extensions/DateTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,15 @@ public static class DateTimeExtensions

return new DateTime(date - (date % excess), input.Value.Kind);
}

public static DateOnly? AsDate(this DateTime? input)
{
if (input is null)
{
return null;
}

return DateOnly.FromDateTime(input.Value);
}
}
}
25 changes: 0 additions & 25 deletions Core/Models/Points/DomScreenerModel.cs

This file was deleted.

12 changes: 4 additions & 8 deletions Core/Models/Points/PointScreenerModel.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
using System;
using Terminal.Core.Domains;

namespace Terminal.Core.Models
{
public class PointScreenerModel
public class PointScreenerModel
{
/// <summary>
/// Symbol name
/// Asset
/// </summary>
public virtual string Name { get; set; }

/// <summary>
/// Security type
/// </summary>
public virtual string Security { get; set; }
public virtual InstrumentModel Instrument { get; set; }

/// <summary>
/// Start date
Expand Down
5 changes: 5 additions & 0 deletions Core/Models/ResponseModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ namespace Terminal.Core.Models
{
public class ResponseModel<T>
{
/// <summary>
/// Item
/// </summary>
public virtual string Cursor { get; set; }

/// <summary>
/// Item
/// </summary>
Expand Down
12 changes: 4 additions & 8 deletions Derivative/Pages/Cointegration.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Microsoft.Extensions.Configuration;
using MudBlazor;
using Schwab;
using Schwab.Messages;
using System;
using System.Collections;
using System.Collections.Generic;
Expand Down Expand Up @@ -92,13 +91,10 @@ protected async Task OnChart<T>(Func<string, PortfolioInputModel, IDictionary<st
{
Descriptor = Configuration.GetValue<string>("Schwab:Account")
},
Scope = new ScopeMessage
{
ConsumerKey = Configuration.GetValue<string>("Schwab:ConsumerKey"),
ConsumerSecret = Configuration.GetValue<string>("Schwab:ConsumerSecret"),
RefreshToken = Configuration.GetValue<string>("Schwab:RefreshToken"),
AccessToken = Configuration.GetValue<string>("Schwab:AccessToken")
}
ClientId = Configuration.GetValue<string>("Schwab:ConsumerKey"),
ClientSecret = Configuration.GetValue<string>("Schwab:ConsumerSecret"),
RefreshToken = Configuration.GetValue<string>("Schwab:RefreshToken"),
AccessToken = Configuration.GetValue<string>("Schwab:AccessToken")
};

var caption = $"{Count++} : {data.Names} : {data.Duration} : {data.Resolution}";
Expand Down
12 changes: 4 additions & 8 deletions Derivative/Pages/Gex.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Microsoft.Extensions.Configuration;
using MudBlazor;
using Schwab;
using Schwab.Messages;
using System;
using System.Collections;
using System.Collections.Generic;
Expand Down Expand Up @@ -49,13 +48,10 @@ protected override async Task OnAfterRenderAsync(bool setup)
{
Descriptor = Configuration.GetValue<string>("Schwab:Account")
},
Scope = new ScopeMessage
{
ConsumerKey = Configuration.GetValue<string>("Schwab:ConsumerKey"),
ConsumerSecret = Configuration.GetValue<string>("Schwab:ConsumerSecret"),
RefreshToken = Configuration.GetValue<string>("Schwab:RefreshToken"),
AccessToken = Configuration.GetValue<string>("Schwab:AccessToken")
}
AccessToken = Configuration["Schwab:AccessToken"],
RefreshToken = Configuration["Schwab:RefreshToken"],
ClientId = Configuration["Schwab:ConsumerKey"],
ClientSecret = Configuration["Schwab:ConsumerSecret"]
};

await Connector.Connect();
Expand Down
12 changes: 4 additions & 8 deletions Derivative/Pages/Options.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using Microsoft.Extensions.Configuration;
using MudBlazor;
using Schwab;
using Schwab.Messages;
using SkiaSharp;
using System;
using System.Collections;
Expand Down Expand Up @@ -215,13 +214,10 @@ protected async Task OnChart<T>(Func<string, dynamic, IList<InstrumentModel>, Ta
{
Descriptor = Configuration.GetValue<string>("Schwab:Account")
},
Scope = new ScopeMessage
{
ConsumerKey = Configuration.GetValue<string>("Schwab:ConsumerKey"),
ConsumerSecret = Configuration.GetValue<string>("Schwab:ConsumerSecret"),
RefreshToken = Configuration.GetValue<string>("Schwab:RefreshToken"),
AccessToken = Configuration.GetValue<string>("Schwab:AccessToken")
}
AccessToken = Configuration["Schwab:AccessToken"],
RefreshToken = Configuration["Schwab:RefreshToken"],
ClientId = Configuration["Schwab:ConsumerKey"],
ClientSecret = Configuration["Schwab:ConsumerSecret"]
};

var caption = $"{Count++} : {data.Name} : {data.Range.Start:yyyy-MM-dd} : {data.Range.End:yyyy-MM-dd}";
Expand Down
12 changes: 4 additions & 8 deletions Derivative/Pages/Portfolio.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Microsoft.Extensions.Configuration;
using MudBlazor;
using Schwab;
using Schwab.Messages;
using System;
using System.Collections;
using System.Collections.Generic;
Expand Down Expand Up @@ -92,13 +91,10 @@ protected async Task OnChart<T>(Func<string, PortfolioInputModel, IDictionary<st
{
Descriptor = Configuration.GetValue<string>("Schwab:Account")
},
Scope = new ScopeMessage
{
ConsumerKey = Configuration.GetValue<string>("Schwab:ConsumerKey"),
ConsumerSecret = Configuration.GetValue<string>("Schwab:ConsumerSecret"),
RefreshToken = Configuration.GetValue<string>("Schwab:RefreshToken"),
AccessToken = Configuration.GetValue<string>("Schwab:AccessToken")
}
AccessToken = Configuration["Schwab:AccessToken"],
RefreshToken = Configuration["Schwab:RefreshToken"],
ClientId = Configuration["Schwab:ConsumerKey"],
ClientSecret = Configuration["Schwab:ConsumerSecret"]
};

var caption = $"{Count++} : {data.Names} : {data.Duration} : {data.Resolution}";
Expand Down
12 changes: 4 additions & 8 deletions Derivative/Services/SyncService.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Distribution.Services;
using Microsoft.Extensions.Configuration;
using Schwab;
using Schwab.Messages;
using System;
using System.Collections;
using System.Collections.Concurrent;
Expand Down Expand Up @@ -34,13 +33,10 @@ public async Task Connect()
{
Descriptor = Configuration.GetValue<string>("Schwab:Account")
},
Scope = new ScopeMessage
{
ConsumerKey = Configuration.GetValue<string>("Schwab:ConsumerKey"),
ConsumerSecret = Configuration.GetValue<string>("Schwab:ConsumerSecret"),
RefreshToken = Configuration.GetValue<string>("Schwab:RefreshToken"),
AccessToken = Configuration.GetValue<string>("Schwab:AccessToken")
}
AccessToken = Configuration["Schwab:AccessToken"],
RefreshToken = Configuration["Schwab:RefreshToken"],
ClientId = Configuration["Schwab:ConsumerKey"],
ClientSecret = Configuration["Schwab:ConsumerSecret"]
};

var interval = new Timer(TimeSpan.FromMinutes(1));
Expand Down
Loading

0 comments on commit 3210ae0

Please sign in to comment.