@@ -12,8 +12,7 @@ Licensed under MIT License, see LICENSE.md
12
12
module Ledgers
13
13
14
14
using UUIDs, StructArrays, AbstractTrees
15
- using Instruments
16
- import Instruments: instrument, symbol, amount, name, currency
15
+ using Assets, Instruments, Currencies
17
16
18
17
export Account, Ledger, Entry, Identifier, AccountId, AccountCode, AccountInfo, AccountGroup
19
18
export id, balance, credit!, debit!, post!, instrument, currency, symbol, amount
@@ -79,7 +78,7 @@ struct AccountGroup{P <: Position} <: AccountNode{P}
79
78
end
80
79
81
80
function AccountGroup (
82
- :: P ,
81
+ :: Type{P} ,
83
82
code,
84
83
name,
85
84
isdebit= true ;
@@ -131,11 +130,17 @@ subgroups(group::AccountGroup) = group.subgroups
131
130
132
131
instrument (:: AccountType{P} ) where {P <: Position } = instrument (P)
133
132
134
- symbol ( :: AccountType{P} ) where {P <: Position } = symbol (P)
133
+ # import Instruments: symbol, currency, instrument, position, amount
135
134
136
- currency (:: AccountType{P} ) where {P <: Position } = currency (P )
135
+ Instruments . symbol (:: AccountType{P} ) where {I, P <: Position{I} } = symbol (I )
137
136
138
- amount (acc:: AccountType ) = amount (balance (acc))
137
+ Instruments. currency (:: AccountType{P} ) where {I,P <: Position{I} } = currency (I)
138
+
139
+ Instruments. instrument (:: AccountType{P} ) where {I,P <: Position{I} } = instrument (I)
140
+
141
+ Instruments. position (:: AccountType{P} ) where {I,P <: Position{I} } = position (I)
142
+
143
+ Instruments. amount (acc:: AccountType ) = amount (balance (acc))
139
144
140
145
debit! (acc:: Account , amt:: Position ) = (acc. balance += amt)
141
146
0 commit comments