-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be47c21
commit cb29f3b
Showing
5 changed files
with
508 additions
and
474 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package broker | ||
|
||
import "time" | ||
|
||
// Tx is a catch-all transaction type | ||
// in this version, it can represent all transaction types except for trades, which need to track quotes at a specific time (Year is not enough) | ||
type Tx struct { | ||
ISIN, Category, Currency string | ||
Amount float64 | ||
Year int | ||
} | ||
|
||
type Trade struct { | ||
// ISIN is the International Securities Identification Number. FIFO method needs to be partitioned by ISIN | ||
ISIN string | ||
// Category is the type of Trade: equity, bond, option, forex, crypto, etc. | ||
Category string | ||
Time time.Time | ||
// Currency is the Currency of the Trade | ||
Currency string `validate:"required,iso4217"` | ||
// Quantity is the number of shares, contracts, or units | ||
Quantity float64 | ||
// Price is the Price per share, contract, or unit | ||
Price float64 | ||
} | ||
|
||
// Statement is an envelope for all relevant broker data from a single file. | ||
// This approach chosen as a middle ground between managing one channel per data type and marshal+switch option | ||
type Statement struct { | ||
Broker string | ||
Filename string | ||
Trades []Trade | ||
FixedIncome, Tax, Fees []Tx | ||
} | ||
|
||
type Reader interface { | ||
Read(filename string) (Statement, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.