financial

How to skip empty dates (weekends) in a financial Matplotlib Python graph?

对着背影说爱祢 提交于 2019-11-26 20:24:24
问题 ax.plot_date((dates, dates), (highs, lows), '-') I'm currently using this command to plot financial highs and lows using Matplotlib. It works great, but how do I remove the blank spaces in the x-axis left by days without market data, such as weekends and holidays? I have lists of dates, highs, lows, closes and opens. I can't find any examples of creating a graph with an x-axis that show dates but doesn't enforce a constant scale. 回答1: I think you need to "artificially synthesize" the exact

ArithmeticException thrown during BigDecimal.divide

大城市里の小女人 提交于 2019-11-26 11:16:04
问题 I thought java.math.BigDecimal is supposed to be The Answer™ to the need of performing infinite precision arithmetic with decimal numbers. Consider the following snippet: import java.math.BigDecimal; //... final BigDecimal one = BigDecimal.ONE; final BigDecimal three = BigDecimal.valueOf(3); final BigDecimal third = one.divide(three); assert third.multiply(three).equals(one); // this should pass, right? I expect the assert to pass, but in fact the execution doesn\'t even get there: one.divide