Skip to content

Commit

Permalink
added back fee model type
Browse files Browse the repository at this point in the history
  • Loading branch information
bcicc committed Oct 16, 2023
1 parent 3eaf7cc commit a7a9f68
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ AlwaysOpenExchange

# Fee Model
```@docs
FeeModel
ZeroFeeModel
PercentFeeModel
calculate_fee
Expand Down
1 change: 1 addition & 0 deletions src/SaguaroTrader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export
AlwaysOpenExchange,

# fee model
FeeModel,
ZeroFeeModel,
PercentFeeModel,
calculate_fee,
Expand Down
2 changes: 2 additions & 0 deletions src/fee_model/fee_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Abstract type to handle the calculation of
brokerage fee, fees and taxes.
"""

abstract type FeeModel end

include("zero_fee_model.jl")
include("percent_fee_model.jl")

Expand Down
2 changes: 1 addition & 1 deletion src/fee_model/percent_fee_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Fields
- `fee_pct::Float64` = 0.0
- `tax_pct::Float64` = 0.0
"""
struct PercentFeeModel
struct PercentFeeModel <: FeeModel
fee_pct::Float64
tax_pct::Float64
function PercentFeeModel(; fee_pct::Float64=0.0, tax_pct::Float64=0.0)
Expand Down
2 changes: 1 addition & 1 deletion src/fee_model/zero_fee_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A FeeModel that produces no fee/fees/taxes.
total_fee = 0.0
"""
struct ZeroFeeModel end
struct ZeroFeeModel <: FeeModel end

function _calc_tax(fee_model::ZeroFeeModel, quantity::Real, price::Float64)
return 0.0
Expand Down

0 comments on commit a7a9f68

Please sign in to comment.