New answers tagged


A limit buy means he is willing to pay up to \$200 for 1 unit. Since there is one offer of 1 unit at \$100 that one will be bought out first followed by 1 unit at \$200. So only a total of \$300 of his money will be deducted.


It depends on how you define rolling momentum. If you define it as the percentage change between the end and the begin of a period, your code is correct.


CapitaFlow Algo requires Rebalance: the capital will remain in the strategy until a re-allocation/rebalancement is made. And Rebalance requires Weight if you include it on your strategy you might see the result: data = bt.get('ETH-USD', start='2018-01-01') s2 = bt.Strategy('s2', [bt.algos.RunMonthly(), bt.algos.SelectAll(), bt.algos.CapitalFlow(1000), ...


The fair rate calculated in the above example is the rate to be used for fixed rate leg to yield 0 NPV. You would need to reconstruct the swap with the float leg as is but a fixed leg with fair rate from above. That should yield a 0 NPV for the swap.


Try casting, something like c = as_coupon(cf) if not c.__nonzero__(): print "principal redemption" You can likewise attempt casting the cf to as_fixed_rate_coupon(cf) or to as_floating_rate_coupon(cf), and if they work, then access other useful info. Also, redemptions is another available inspector. Related question: how can i see the ...


You need to get the open of the first candle, the high and low over all candles in the time frame and the close of the last candle. R has a package for this, your language of choice might have it as well.


When you sample stock market data, you really need to understand what source(s) and rules are being used, and any adjustments applied to the data. Different rules might also exist for different periodicities sampled too. There are may different/methodologies applied to Consolidated tape price versus listed exchange price versus a specific exchange price. ...


In R, the simplest way to brute force through a predefined number of portfolio combinations would be to simply iterate over them: set.seed(42) returns <- matrix(rnorm(200),40,5) weights <- list(c(1,0,0,0,0), c(0,1,0,0,0), c(0,0,1,0,0), c(0,0,0,1,0), c(0,0,0,0,1)) conf <- 0.99 sapply(...


I will write some pseudocode. N = 10 /* number of orders */ prices = [100, 108.01, 116.65, 125.99, 136.08, 146.97, 158.74, 171.45, 185.17, 200.0] /* these are the given prices */ ones = [1,1,1,1,1,1,1,1,1,1] /* N ones */ staircase = [0,1,2,3,4,5,6,7,8,9] /* starts at 0 and counts up by 1 until N-1 */ desired_avg_price = 135 avg_price_eqweighted = AVERAGE(...

Top 50 recent answers are included