Documentation
¶
Index ¶
- Constants
- type AccountManager
- type AccountManagerImpl
- type AutoManagerImpl
- type AutoManagerInterface
- type CapitalGainManager
- type CapitalGainManagerImpl
- type DividendManager
- type DividendManagerImpl
- type ExcelManager
- type ExcelManagerImpl
- type ExchangeManager
- type ExchangeManagerImpl
- type FinancialYearManager
- type FinancialYearManagerImpl
- type InterestManager
- type InterestManagerImpl
- type SBIManager
- type SBIManagerImpl
- type TaxManager
- type TaxManagerImpl
- type TaxValuationManager
- type TaxValuationManagerImpl
- type TickerManager
- type TickerManagerImpl
- func (t *TickerManagerImpl) DownloadTicker(ctx context.Context, ticker string) (err common.HttpError)
- func (t *TickerManagerImpl) FindPeakPrice(_ context.Context, ticker string, year int) (peakPrice tax.PeakPrice, err common.HttpError)
- func (t *TickerManagerImpl) GetPrice(ctx context.Context, ticker string, date time.Time) (float64, common.HttpError)
- type ValuationManager
- type ValuationManagerImpl
Constants ¶
const ( SIDE_MONITOR = 1 MAIL_WORKSPACE = "2" DATE_FORMAT = "20060102__150405" LOGSEQ_CLASS = "Logseq" NETWORK_RESTART_DELAY = 5 * time.Second UI_INTERACTION_DELAY = 50 * time.Millisecond TRADE_INFO = ` Trends HTF - Up MTF - Up TTF - Up Plan: Longs @ TTF DZ Obstacles: - Support: -` )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountManager ¶
type AccountManager interface {
GetRecord(ctx context.Context, symbol string) (tax.Account, common.HttpError)
}
func NewAccountManager ¶
func NewAccountManager(repo repository.AccountRepository) AccountManager
type AccountManagerImpl ¶
type AccountManagerImpl struct {
// contains filtered or unexported fields
}
type AutoManagerImpl ¶
type AutoManagerImpl struct {
// contains filtered or unexported fields
}
func (*AutoManagerImpl) MonitorInternetConnection ¶
func (a *AutoManagerImpl) MonitorInternetConnection(_ context.Context)
func (*AutoManagerImpl) MonitorSubmap ¶
func (a *AutoManagerImpl) MonitorSubmap(_ context.Context)
func (*AutoManagerImpl) RecordTicker ¶
func (a *AutoManagerImpl) RecordTicker(_ context.Context, ticker, path string) (err error)
Copy existing implementations preserving comments but as methods
func (*AutoManagerImpl) TryOpenTicker ¶
func (a *AutoManagerImpl) TryOpenTicker(_ context.Context, ticker string)
type AutoManagerInterface ¶
type AutoManagerInterface interface { RecordTicker(ctx context.Context, ticker, path string) error TryOpenTicker(ctx context.Context, ticker string) MonitorInternetConnection(ctx context.Context) MonitorSubmap(ctx context.Context) }
func NewAutoManager ¶
func NewAutoManager(wait time.Duration, capturePath string) AutoManagerInterface
type CapitalGainManager ¶
type CapitalGainManagerImpl ¶
type CapitalGainManagerImpl struct {
// contains filtered or unexported fields
}
func NewCapitalGainManager ¶
func NewCapitalGainManager(exchangeManager ExchangeManager, gainsRepository repository.GainsRepository, financialYearManager FinancialYearManager[tax.Gains]) *CapitalGainManagerImpl
func (*CapitalGainManagerImpl) GetGainsForYear ¶
type DividendManager ¶
type DividendManager interface { // Retrieves all Dividend records for the specified financial year. // The year parameter represents the starting year of the financial year (e.g., 2023 for FY 2023-24). GetDividendsForYear(ctx context.Context, year int) ([]tax.Dividend, common.HttpError) // Processes a list of Dividend records, adding INR values based on exchange rates. ProcessDividends(ctx context.Context, dividends []tax.Dividend) ([]tax.INRDividend, common.HttpError) }
type DividendManagerImpl ¶
type DividendManagerImpl struct {
// contains filtered or unexported fields
}
func NewDividendManager ¶
func NewDividendManager( exchangeManager ExchangeManager, financialYearManager FinancialYearManager[tax.Dividend], dividendRepository repository.DividendRepository, ) *DividendManagerImpl
func (*DividendManagerImpl) GetDividendsForYear ¶
func (d *DividendManagerImpl) GetDividendsForYear(ctx context.Context, year int) ([]tax.Dividend, common.HttpError)
GetDividendsForYear implementation added
func (*DividendManagerImpl) ProcessDividends ¶
func (d *DividendManagerImpl) ProcessDividends(ctx context.Context, dividends []tax.Dividend) (inrDividends []tax.INRDividend, err common.HttpError)
type ExcelManager ¶
type ExcelManager interface {
GenerateTaxSummaryExcel(ctx context.Context, summary tax.Summary) error
}
func NewExcelManager ¶
func NewExcelManager(outputFilePath string) ExcelManager
type ExcelManagerImpl ¶
type ExcelManagerImpl struct {
// contains filtered or unexported fields
}
func (*ExcelManagerImpl) GenerateTaxSummaryExcel ¶
type ExchangeManager ¶
type ExchangeManager interface { Exchange(ctx context.Context, exchangeables []tax.Exchangeable) common.HttpError // ExchangeGains applies exchange rates to INRGains items. // For each gain, it uses the SBI TT Buy Rate from the last day of the month // immediately preceding the month of that gain's SellDate. // If an exact rate for that date is not found, it relies on the underlying // SBI rate provider to furnish a rate for the closest available date. ExchangeGains(ctx context.Context, gains []tax.INRGains) common.HttpError }
func NewExchangeManager ¶
func NewExchangeManager(sbiManager SBIManager) ExchangeManager
type ExchangeManagerImpl ¶
type ExchangeManagerImpl struct {
// contains filtered or unexported fields
}
func (*ExchangeManagerImpl) Exchange ¶
func (e *ExchangeManagerImpl) Exchange(ctx context.Context, exchangeables []tax.Exchangeable) common.HttpError
func (*ExchangeManagerImpl) ExchangeGains ¶
type FinancialYearManager ¶
type FinancialYearManager[T tax.CSVRecord] interface { FilterIndia(ctx context.Context, records []T, year int) ([]T, common.HttpError) FilterUS(ctx context.Context, records []T, year int) ([]T, common.HttpError) }
func NewFinancialYearManager ¶
func NewFinancialYearManager[T tax.CSVRecord]() FinancialYearManager[T]
type FinancialYearManagerImpl ¶
func (*FinancialYearManagerImpl[T]) FilterIndia ¶
type InterestManager ¶
type InterestManager interface { // Retrieves all Interest records for the specified financial year. // The year parameter represents the starting year of the financial year (e.g., 2023 for FY 2023-24). GetInterestForYear(ctx context.Context, year int) ([]tax.Interest, common.HttpError) // Processes a list of Interest records, adding INR values based on exchange rates. ProcessInterest(ctx context.Context, interest []tax.Interest) ([]tax.INRInterest, common.HttpError) }
Interface definition updated
type InterestManagerImpl ¶
type InterestManagerImpl struct {
// contains filtered or unexported fields
}
Implementation struct updated with new dependencies
func NewInterestManager ¶
func NewInterestManager( exchangeManager ExchangeManager, financialYearManager FinancialYearManager[tax.Interest], interestRepository repository.InterestRepository, ) *InterestManagerImpl
Constructor updated to accept new dependencies
func (*InterestManagerImpl) GetInterestForYear ¶
func (i *InterestManagerImpl) GetInterestForYear(ctx context.Context, year int) ([]tax.Interest, common.HttpError)
GetInterestForYear implementation added
func (*InterestManagerImpl) ProcessInterest ¶
func (i *InterestManagerImpl) ProcessInterest(ctx context.Context, interests []tax.Interest) (inrInterests []tax.INRInterest, err common.HttpError)
ProcessInterest implementation (Ensure it uses injected exchangeManager)
type SBIManager ¶
type SBIManagerImpl ¶
type SBIManagerImpl struct {
// contains filtered or unexported fields
}
func NewSBIManager ¶
func NewSBIManager(client clients.SBIClient, filePath string, exchangeRepo repository.ExchangeRepository) *SBIManagerImpl
func (*SBIManagerImpl) DownloadRates ¶
func (s *SBIManagerImpl) DownloadRates(ctx context.Context) (err common.HttpError)
func (*SBIManagerImpl) GetTTBuyRate ¶
type TaxManager ¶
type TaxManager interface { GetTaxSummary(ctx context.Context, year int) (tax.Summary, common.HttpError) SaveTaxSummaryToExcel(ctx context.Context, summary tax.Summary) error }
func NewTaxManager ¶
func NewTaxManager( capitalGainManager CapitalGainManager, dividendManager DividendManager, interestManager InterestManager, taxValuationManager TaxValuationManager, excelManager ExcelManager, ) TaxManager
type TaxManagerImpl ¶
type TaxManagerImpl struct {
// contains filtered or unexported fields
}
func (*TaxManagerImpl) GetTaxSummary ¶
func (*TaxManagerImpl) SaveTaxSummaryToExcel ¶
type TaxValuationManager ¶
type TaxValuationManager interface { // Processes a list of Valuation records, adding INR values based on exchange rates. ProcessValuations(ctx context.Context, valuations []tax.Valuation) ([]tax.INRValuation, common.HttpError) // GetYearlyValuationsUSD calculates the base USD Valuation (First, Peak, YearEnd) // for all relevant tickers based on trade history up to the end of the specified calendar year. GetYearlyValuationsUSD(ctx context.Context, year int) ([]tax.Valuation, common.HttpError) }
TaxValuationManager handles currency exchange rate processing
func NewTaxValuationManager ¶
func NewTaxValuationManager(exchangeManager ExchangeManager, valuationManager ValuationManager) TaxValuationManager
NewTaxValuationManager creates a new instance of TaxValuationManager
type TaxValuationManagerImpl ¶
type TaxValuationManagerImpl struct {
// contains filtered or unexported fields
}
Implementation struct updated with ValuationManager
func (*TaxValuationManagerImpl) GetYearlyValuationsUSD ¶
func (v *TaxValuationManagerImpl) GetYearlyValuationsUSD(ctx context.Context, year int) ([]tax.Valuation, common.HttpError)
GetYearlyValuationsUSD passes the call through to the underlying ValuationManager.
func (*TaxValuationManagerImpl) ProcessValuations ¶
func (v *TaxValuationManagerImpl) ProcessValuations(ctx context.Context, valuations []tax.Valuation) (inrValuations []tax.INRValuation, err common.HttpError)
type TickerManager ¶
type TickerManagerImpl ¶
type TickerManagerImpl struct {
// contains filtered or unexported fields
}
func NewTickerManager ¶
func NewTickerManager(client clients.AlphaClient, downloads string) *TickerManagerImpl
func (*TickerManagerImpl) DownloadTicker ¶
func (*TickerManagerImpl) FindPeakPrice ¶
type ValuationManager ¶
type ValuationManager interface { AnalyzeValuation(ctx context.Context, tickerSymbol string, trades []tax.Trade, year int) (tax.Valuation, common.HttpError) // GetYearlyValuationsUSD calculates the base USD Valuation (First, Peak, YearEnd) // for all relevant tickers based on trade history up to the end of the specified calendar year. GetYearlyValuationsUSD(ctx context.Context, year int) ([]tax.Valuation, common.HttpError) }
func NewValuationManager ¶
func NewValuationManager( tickerManager TickerManager, accountManager AccountManager, tradeRepository repository.TradeRepository, fyManager FinancialYearManager[tax.Trade], ) ValuationManager
type ValuationManagerImpl ¶
type ValuationManagerImpl struct {
// contains filtered or unexported fields
}
func (*ValuationManagerImpl) AnalyzeValuation ¶
func (v *ValuationManagerImpl) AnalyzeValuation(ctx context.Context, tickerSymbol string, trades []tax.Trade, year int) (tax.Valuation, common.HttpError)
AnalyzeValuation calculates valuation based on trades and opening position for a given ticker.