Newbie question pertaining to API and Cloud Notes

Custom indicators, trading strategies, data export and recording and more...
dgtrade
Posts: 2
Joined: Sat Apr 10, 2021 12:19 pm

Re: Newbie question pertaining to API and Cloud Notes

Post by dgtrade » Sun Apr 18, 2021 9:23 pm

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


 
Attachments
lastPricePainter - Object.PNG
lastPricePainter - Object.PNG (51.63 KiB) Viewed 6018 times
Layer1ApiLastPricePlankDemo.java
(9.97 KiB) Downloaded 308 times
data.csv
(16 Bytes) Downloaded 289 times

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Newbie question pertaining to API and Cloud Notes

Post by Andry API support » Wed Apr 21, 2021 10:56 am

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.
Attachments
Layer1ApiCsvSSP.java
(8.94 KiB) Downloaded 328 times

cw45068
Posts: 5
Joined: Tue Aug 11, 2020 3:32 pm
Has thanked: 3 times

Re: Newbie question pertaining to API and Cloud Notes

Post by cw45068 » 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

cw45068
Posts: 5
Joined: Tue Aug 11, 2020 3:32 pm
Has thanked: 3 times

Re: Newbie question pertaining to API and Cloud Notes

Post by cw45068 » Sat Aug 20, 2022 4:36 pm

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
 

cw45068
Posts: 5
Joined: Tue Aug 11, 2020 3:32 pm
Has thanked: 3 times

Re: Newbie question pertaining to API and Cloud Notes

Post by cw45068 » Tue Aug 23, 2022 8:36 pm

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

Post Reply