Page 2 of 2

Re: Newbie question pertaining to API and Cloud Notes

Posted: Sun Apr 18, 2021 9:23 pm
by dgtrade
AndreyR wrote:
Tue Jan 12, 2021 9:44 am
hi dmavro,

Do you need horizontal geometrical rays (lines that start and never end, hope I got you right)?

If yes, you can develop a module that will draw those for you. A good starting point is a Bookmap API Tutorial. What you need is everything from the start to (including) "Hello Bookmap addon in 2 minutes". You will learn how to start a project and to make a simple custom module.

Your task may be divided in two:
1) read a CSV file
You may use a library like OpenCSV. Here is a tutorial example. Note, there is a maven project used in the example and you will be using gradle project so your Set-Up will be looking differently (Google how to add a dependency to a gradle project).
So you'll need to read, store and transform the data to numerical values.
2) draw lines
To draw a ray all you need to register an indicator and to draw one point. Please take a look at LastTradeDemoNoHistory at simplified demo strategies.

Hello AndrejR,

Based on Bookmaps Demo class Layer1ApiMarkersDemo.java I adjusted the code a little so that it creates a CanvasIcon based on a csv input file. ( Essentially the CompositeVerticalCoordinate y2 variable value is populated from 
the csv file. In that sense it's a static line attached to price level from csv file).  That works well and Bookmap renders the object as expected (e.g level 16400 pips is converted into 4100 Points on ES Future)

However the code does this only for the first record in the csv file. After processing the first record it does not process more records aka iterating through the file.
I think this is because in line 250 when I return the lastPricePainter object the iteration stops completely.
However based on the CSV file I want to create more objects (each record of the csv should create a 'lastPricePainter' object)

I'm a real java beginner and I would be very greateful if you have an idea at hand on how to solve this problem. I attached the
code , screenshot and an example csv file with 2 records. Any input is much appreciated.

Thank you very much.

Daniel


 

Re: Newbie question pertaining to API and Cloud Notes

Posted: Wed Apr 21, 2021 10:56 am
by Andry API support
Hi Daniel,
Thx for you code and the screenshot. I made some changes so it produces more than one line now. Pls check and use in your modules.

Re: Newbie question pertaining to API and Cloud Notes

Posted: Sat Aug 20, 2022 12:31 am
by cw45068
I’m trying to use the code @AndreyR provided above.  Is this functional as provided? I updated the path to my csv file ( which complies with the format ) and I get no lines.


Thanks,
Chuck

Re: Newbie question pertaining to API and Cloud Notes

Posted: Sat Aug 20, 2022 4:36 pm
by cw45068
cw45068 wrote:
Sat Aug 20, 2022 12:31 am
I’m trying to use the code @AndreyR provided above.  Is this functional as provided? I updated the path to my csv file ( which complies with the format ) and I get no lines.


Thanks,
Chuck
It is functional...."pips" wasn't applied...working now
 

Re: Newbie question pertaining to API and Cloud Notes

Posted: Tue Aug 23, 2022 8:36 pm
by cw45068
Code is working great...as a newbie to Java though, having a hard time changing the line style...

Any hints would be appreciated....after Dash-Dot