27 lines
917 B
C#
27 lines
917 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Alpaca.Markets;
|
|
using FinlyticCore.Models.Trades;
|
|
|
|
namespace FinlyticBot.Services;
|
|
|
|
public record BrokerAccountInfo(
|
|
decimal Equity,
|
|
decimal BuyingPower,
|
|
decimal Cash,
|
|
string Currency,
|
|
bool IsBlocked
|
|
);
|
|
|
|
public interface IAlpacaBrokerService
|
|
{
|
|
Task<BrokerAccountInfo?> GetAccountInfoAsync(CancellationToken ct = default);
|
|
Task<IAsset?> GetAssetAsync(string symbol, CancellationToken ct = default);
|
|
Task<IClock?> GetMarketClockAsync(CancellationToken ct = default);
|
|
Task<IOrder?> PlaceBracketOrderAsync(TradeProposalDto proposal, decimal quantity, string orderType = "Limit", CancellationToken ct = default);
|
|
Task<bool> CancelOrderAsync(Guid orderId, CancellationToken ct = default);
|
|
Task<IReadOnlyList<IOrder>> GetOpenOrdersAsync(CancellationToken ct = default);
|
|
}
|