Hi I am trying to plot some financial US Treasury bond data correctly in plotly and not sure what the best approach is (Tick size - Wikipedia). This data is priced in 32nds so if the decimal price is 110.50, the correct way to display it is 110-16. I have functions which will convert from decimal to tic 32nd (as a string β110-16β or as a decimal 110.16) and I would like to display this as a line graph where the axis (and hovers) are correctly displayed.
For instance if I have the following series
x = [1,2,3,4,5]
y1 = [100,100.0625,100.25,100.03125,100.96875,101.00,100.00]
in tic this is equal to
y2 = ["100-00", "100-08", "100-03", "100-01", "100-31","101-00","100-00"]
or an alternative notation using decimal convention is
y3 = [100.00.100.08,100.03,100.01,100.32,101.00,100.00]
if I create a series
import plotly.express as px
import pandas as pd
df = pd.Series(data=y,index=x)
px.line(df)
if I use y=y1 it obviously works but does not display the tic
if I use y=y3 it sort of works but ideally I would like to replace the decimal point β.β with a β-β. In addition there would be large jumps between 101.31 and 102.00 which is just 1/32.
if I use y=y2 then is obviously doesnβt work since they are assumed as strings. I thought about using y1 and then replacing the decimal values with tic values on the y axis but not sure if a) this is a good method and or b) there is a better way of going this.
Any ideas / advice would be great.
Thanks