mirror of
https://github.com/we-promise/sure
synced 2026-04-25 17:15:07 +02:00
Add transaction fee support to trades (#1248)
Add an optional fee field (decimal, precision: 19, scale: 4) to trades. Fee is included in the total amount calculation (qty * price + fee) for both create and update flows. The fee field appears on both the create and edit forms, defaults to 0, and auto-submits like other trade fields. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
5
db/migrate/20260322120702_add_fee_to_trades.rb
Normal file
5
db/migrate/20260322120702_add_fee_to_trades.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddFeeToTrades < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_column :trades, :fee, :decimal, precision: 19, scale: 4, default: 0, null: false
|
||||
end
|
||||
end
|
||||
1
db/schema.rb
generated
1
db/schema.rb
generated
@@ -1424,6 +1424,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_03_26_112218) do
|
||||
t.string "currency"
|
||||
t.jsonb "locked_attributes", default: {}
|
||||
t.string "investment_activity_label"
|
||||
t.decimal "fee", precision: 19, scale: 4, default: "0.0", null: false
|
||||
t.index ["investment_activity_label"], name: "index_trades_on_investment_activity_label"
|
||||
t.index ["security_id"], name: "index_trades_on_security_id"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user