From: Nicholas Kormanik on 8 Dec 2009 06:50 Trying to set up way to find the number of options contracts one can purchase with a given amount of money. Could someone please edit the code if needed? Or does this look okay as is? Thanks..... pricepercontract := .71 numbercontracts := x feepercontract := .75 tradecomission := 9.99 totalcost := 25000 Solve[100*pricepercontract*numbercontracts*feepercontract + tradecomission == totalcost, x]
From: DrMajorBob on 9 Dec 2009 05:44 I'd prefer something like pricepercontract = .71; feepercontract = .75; tradecomission = 9.99; totalcost = 25000; limit = Rationalize[ 100*pricepercontract*numbercontracts*feepercontract + tradecomission <= totalcost] Maximize[{numbercontracts, limit}, numbercontracts, Integers] 999/100 + (213 numbercontracts)/4 <= 25000 {469, {numbercontracts -> 469}} Bobby On Tue, 08 Dec 2009 05:43:30 -0600, Nicholas Kormanik <nkormanik(a)gmail.com> wrote: > > Trying to set up way to find the number of options contracts one can > purchase with a given amount of money. Could someone please edit the > code if needed? Or does this look okay as is? > > Thanks..... > > > pricepercontract := .71 > numbercontracts := x > feepercontract := .75 > tradecomission := 9.99 > totalcost := 25000 > > Solve[100*pricepercontract*numbercontracts*feepercontract + > tradecomission == totalcost, x] > > > > -- DrMajorBob(a)yahoo.com
From: Michael Stern on 9 Dec 2009 05:44 Also, a mathematica issue on top of your math issues -- you can't solve for X in an equation that has no Xs. Michael Nicholas Kormanik wrote: > Trying to set up way to find the number of options contracts one can > purchase with a given amount of money. Could someone please edit the > code if needed? Or does this look okay as is? > > Thanks..... > > > pricepercontract := .71 > numbercontracts := x > feepercontract := .75 > tradecomission := 9.99 > totalcost := 25000 > > Solve[100*pricepercontract*numbercontracts*feepercontract + > tradecomission == totalcost, x] > > > > >
From: Michael Stern on 9 Dec 2009 05:41 This isn't really a Mathematica question so much as it is a basic math question. Anyway, you have an error in that you have conflated the number of shares (number of contracts*100) with the number of contracts, and another error in that you are multiplying the fee times the price; assuming that's a dollar fee, it makes no sense. Your basic equation should look something like total cost = ((dollar price per contract+ dollar fee per contract) * number of contracts) + dollartradecommission If you have been given your fee per contract or your commission in percentage terms, the math will look a little different. And in real life, I don't think I've ever seen both fee per contract and commission; generally it's one or the other. MS On Dec 8, 2009, at 6:43 AM, Nicholas Kormanik wrote: > > Trying to set up way to find the number of options contracts one can > purchase with a given amount of money. Could someone please edit the > code if needed? Or does this look okay as is? > > Thanks..... > > > pricepercontract := .71 > numbercontracts := x > feepercontract := .75 > tradecomission := 9.99 > totalcost := 25000 > > Solve[100*pricepercontract*numbercontracts*feepercontract + > tradecomission == totalcost, x] > > > >
|
Pages: 1 Prev: How to combine Dynamic graphics Next: unreadable text in Demonstration projects |