Compare commits

...

2 Commits

Author SHA1 Message Date
5f830294b0 update readme
All checks were successful
continuous-integration/drone/push Build is passing
2023-11-13 12:14:29 -07:00
6436707a5d better error and update comments 2023-11-13 12:14:19 -07:00
2 changed files with 11 additions and 4 deletions

View File

@ -12,7 +12,7 @@ It syncs your balance like magic!
### Example docker-compose.yml ### Example docker-compose.yml
The values below are examples only. You can configure as many account pairings as you want using environment variables in a continuous series starting from 0 as shown below. Two example accounts are configured ending in _0 and _1 but a third can be added by adding account numbers/ID with _2. The values below are examples only, and show how to configure the Questrade and Bitcoin providers. With these providers, you can configure as many account pairings as you want using environment variables in a continuous series starting from 0 as shown below. Two example Questrade accounts are configured ending in _0 and _1 but a third can be added by adding account numbers/ID with _2. See the respective README.md files inside the provider directories for more details.
```yaml ```yaml
version: '3.8' version: '3.8'
@ -32,9 +32,15 @@ services:
- ynab_secret=98Q_J655F_TAyGnhCCDS4uqRe4R5654DT2d-ZXdssZ - ynab_secret=98Q_J655F_TAyGnhCCDS4uqRe4R5654DT2d-ZXdssZ
- bitcoin_address_0=bc1qg0edu4tr7pza8qsxf576r0eulr2ygt3mhldswg - bitcoin_address_0=bc1qg0edu4tr7pza8qsxf576r0eulr2ygt3mhldswg
- bitcoin_address_1=bc1qeh0dkdqvjyt646657lge0nxqj67z5xa8zxl8q3 - bitcoin_address_1=bc1qeh0dkdqvjyt646657lge0nxqj67z5xa8zxl8q3
- bitcoin_address_2=bc1qsfsdqvj4443t64dfssfgexsaqj67z44dsjkfkj
- bitcoin_ynab_account=1f5bec0d-f852-2fbe-bbee-02fa98ded566 # Bitcoin addresses map to single YNAB account - bitcoin_ynab_account=1f5bec0d-f852-2fbe-bbee-02fa98ded566 # Bitcoin addresses map to single YNAB account
volumes: volumes:
- /data/ynab-portfolio-monitor-data:/data - /data/ynab-portfolio-monitor-data:/data
``` ```
### Static JSON Providers
If your broker doesn't have a provider available, or if you don't want to connect this application to your brokerage account, there is an offline solution available where you can configure your holdings in local static JSON files - and these only need to be updated if your holdings change such as after a trade has been made, or a stock split.
For more details, see the README.md files located in the provider directories prefixed with "staticjson".

View File

@ -9,7 +9,7 @@ import (
) )
var ( var (
configuredProviders []AccountProvider // Any providers that are successfully configured get added to this slice configuredProviders []AccountProvider // Any account providers that are successfully configured get added to this slice
ynabClient *ynab.Client // YNAB HTTP client ynabClient *ynab.Client // YNAB HTTP client
) )
@ -29,7 +29,8 @@ func init() {
} }
} }
// Loop through all providers and attempt to configure them // Loop through all account providers and attempt to configure them
// if configuration fails, the provider will not be used
configuredProviders = make([]AccountProvider, 0) configuredProviders = make([]AccountProvider, 0)
for _, p := range allProviders { for _, p := range allProviders {
err := p.Configure() err := p.Configure()
@ -60,7 +61,7 @@ func main() {
continue continue
} }
if len(balances) != len(accountIDs) { if len(balances) != len(accountIDs) {
log.Printf("mismatched balance and accountID slice lengths - expected the same: balances length = %d, accountIDs length = %d", len(balances), len(accountIDs)) log.Printf("'%s' provider data validation error: mismatched balance and accountID slice lengths - expected the same: balances length = %d, accountIDs length = %d", p.Name(), len(balances), len(accountIDs))
continue continue
} }
for i := range balances { for i := range balances {