Newbie question pertaining to API and Cloud Notes

Custom indicators, trading strategies, data export and recording and more...
dmavro
Posts: 52
Joined: Thu Sep 24, 2020 9:20 pm
Been thanked: 1 time

Newbie question pertaining to API and Cloud Notes

Post by dmavro » Tue Jan 12, 2021 1:18 am

Hey guys,
Ive been using Bookmap for a few months now and have been using Local Cloud Notes since the end of the first week. Problem is I have to manually add horizontal lines each day at all the prices my notes are at. My goal is to create an addon that can read the local CSV file and add the lines automatically. Even better would be to add rays that would have starting points that are predefined by my indicator that creates my CSV file.
I was wondering if there was anything in the API examples that would be a good starting point? I currently have very limited experience with Java but am able to write OOEL based code in Tradestation so im hoping that will help me move forward with Java coding. One last thing, I use Tradestation to create the CSV file and am not sure if there would be a better way to get the information from Tradestation into Bookmap via the API. Im open to any solution but simplicity might be the best way for me now considering my aforementioned experience with Java.
 
 
Any suggestions would be greatly appreciated!
Thank you,
Dean

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 » 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.

dmavro
Posts: 52
Joined: Thu Sep 24, 2020 9:20 pm
Been thanked: 1 time

Re: Newbie question pertaining to API and Cloud Notes

Post by dmavro » Sun Jan 17, 2021 1:37 am

AndreyR,

Thank you for responding. I will try and look at those links in your post tonight or tomorrow. To answer your question, yes i do need horizontal rays that have start points and never end. For the most part all of the price levels have static prices that never change throughout the day. But I also have another set of price levels that i will eventually need to add which change throughout the day so i will need end points for those.  They represent a price band  that i use on Tradestation. For now i plan on just plotting  the high and low as horizontal rays also but my end game is to have those plot as rectangles. Is that also possible to achieve? 

Thank you again! 

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 » Mon Jan 18, 2021 6:40 am

Hi,
 is to have those plot as rectangles
The API allows to draw rectangles. We need an example to be sure about the implementation. Please make a screenshot from Bookmap and use any graphics editor to draw the rectangles you need to be drawn with the API. Attach the screenshot to your message (Full Editor & Preview -> Attachments) so we can take a look.

dmavro
Posts: 52
Joined: Thu Sep 24, 2020 9:20 pm
Been thanked: 1 time

Re: Newbie question pertaining to API and Cloud Notes

Post by dmavro » Fri Jan 29, 2021 4:57 am

Sorry for late response. Have had a lot going on past week or so. I decided to worry about one thing at a time and am not going to worry about the rectangles for the moment. 

I did however hit a snag  following the Hello World java code in the API tutorial. I have no idea what i did wrong because im getting errors in the problem window of eclipse. Alot of them. I was confused  as to where the HelloBookmapAPI_v1.java and HelloBookmapAPI_v2.java were actually supposed to be in the project. i basically just selected File -> New -> Class to create them. If anyone could tell me what i did wrong id really appreciate it because im stumped. Here's a  list of my errors in my Problem window....

Description    Resource    Path    Location    Type
Api cannot be resolved to a type    HelloBookmapAPI_v2.java    /lib/src/main/java/bookmap/api/tutorial    line 7    Java Problem
CustomModule cannot be resolved to a type    HelloBookmapAPI_v2.java    /lib/src/main/java/bookmap/api/tutorial    line 4    Java Problem
CustomModuleAdapter cannot be resolved to a type    HelloBookmapAPI_v1.java    /lib/src/main/java/bookmap/api/tutorial    line 2    Java Problem
InitialState cannot be resolved to a type    HelloBookmapAPI_v2.java    /lib/src/main/java/bookmap/api/tutorial    line 7    Java Problem
InstrumentInfo cannot be resolved to a type    HelloBookmapAPI_v2.java    /lib/src/main/java/bookmap/api/tutorial    line 7    Java Problem
Layer1ApiVersion cannot be resolved to a type    HelloBookmapAPI_v2.java    /lib/src/main/java/bookmap/api/tutorial    line 3    Java Problem
Layer1ApiVersionValue cannot be resolved to a variable    HelloBookmapAPI_v2.java    /lib/src/main/java/bookmap/api/tutorial    line 3    Java Problem
Layer1SimpleAttachable cannot be resolved to a type    HelloBookmapAPI_v1.java    /lib/src/main/java/bookmap/api/tutorial    line 1    Java Problem
Layer1SimpleAttachable cannot be resolved to a type    HelloBookmapAPI_v2.java    /lib/src/main/java/bookmap/api/tutorial    line 1    Java Problem
Layer1StrategyName cannot be resolved to a type    HelloBookmapAPI_v2.java    /lib/src/main/java/bookmap/api/tutorial    line 2    Java Problem
Log cannot be resolved    HelloBookmapAPI_v2.java    /lib/src/main/java/bookmap/api/tutorial    line 8    Java Problem
Log cannot be resolved    HelloBookmapAPI_v2.java    /lib/src/main/java/bookmap/api/tutorial    line 13    Java Problem
The declared package "" does not match the expected package "bookmap.api.tutorial"    HelloBookmapAPI_v1.java    /lib/src/main/java/bookmap/api/tutorial    line 1    Java Problem
The declared package "" does not match the expected package "bookmap.api.tutorial"    HelloBookmapAPI_v2.java    /lib/src/main/java/bookmap/api/tutorial    line 1    Java Problem
The method stop() of type HelloBookmapAPI_v2 must override or implement a supertype method    HelloBookmapAPI_v2.java    /lib/src/main/java/bookmap/api/tutorial    line 12    Java Problem


And heres what workspace looks like...

Image

Thanks,
Dean

dmavro
Posts: 52
Joined: Thu Sep 24, 2020 9:20 pm
Been thanked: 1 time

Re: Newbie question pertaining to API and Cloud Notes

Post by dmavro » Sat Jan 30, 2021 3:55 am

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.
This is really confusing me. After running 'gradle init --type java-library' in powershell I then took the bookmap-api-tutorial as is and ran 'gradle jar' command. Next i tried adding the lib.jar from the new Build/libs folder that was created  and i get Error loading jar message box which says "No entry points found in jar."   I searched the forum and found some mention of it but didnt find any solution that applied. 

Also notuced this message in Console...... 


Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.1/userguide ... e_warnings

CONFIGURE SUCCESSFUL in 438ms


Not sure if thats an issue or just a warning.

I tried most recent version of Eclipse too and still same thing. Ive started the entire process over from the beginning of the API Tutorial you mentioned and each time i get hung up right where the "Hello Bookmap" Java code section is. Right after i paste the code from the forum i see the errors appear to the left of the line numbers of the java files in the project. If i continue with the tutorial and run 'gradle jar' in powershell a jar file named bookmap-api-tutorial.jar is never created in that folder.  I only see lib.jar file still.

The error im seeing makes me think eclipse doesnt recognize any references to Bookmap's API. Am i missing some crucial step from when i setup environment?? Am i using wrong version of Gradle or maybe missing some Path reference in my Eclipse settings? I updated Buildship in eclipse when i started this whole process a few nights ago and then last night i removed it and reinstalled it again. Im running out of ideas and would love to make it past this hurdle so i can start my project. Any help would be truly appreciated!


Thanks,
Dean 

 

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 » Mon Feb 01, 2021 7:40 am

Hi,
pls archive your project and send me in a private message.

dmavro
Posts: 52
Joined: Thu Sep 24, 2020 9:20 pm
Been thanked: 1 time

Re: Newbie question pertaining to API and Cloud Notes

Post by dmavro » Tue Mar 02, 2021 6:44 pm

Hey guys,

I finally put something together and have been testing and debugging since last week. I have some issues that i have not been able to fix and i was hoping i could get some help. 

1. Currently, if i add the addon to bookmap and enable it appears to plot correctly but if i enable it on a 2nd subscription then the 1st subscriptions values will plot for some of the 2nd subscriptions indicator values and vice/versa. Whats happening is that some of my values in the CSV dont exist some days (not even a 0 plot). They simply are not written to the CSV file for the day and it looks like the addon is just filling them in from the other subscription if they exist for that one for the day.  I expected the addon to just plot a zero value which is the default variable value i have written into the code but it doesnt. I guess I could just make changes to the indicator that writes the CSV and make it include a zero value for the values that dont exist for the day but id rather not plot something at zero all day anyway. I did attempt to  add checks for null to those indicators that have no values for the day but i ran into issues when i tried.  

2. Like i mentioned in my earlier posts. I really have no experience with Java and had absolutely none with the API before attempting this project so when i was trying to build my addon i did alot of copying and pasting from other posts and from other websites. While i was attempting to get everything to compile in Eclipse i had to make a lot of changes to those snippets of code. I was very unsure of my use of things like public, private, static, final and volatile in my methods and would like to know if what i wrote is written properly. Therefore, I would appreciate it if someone would be willing to look over what i have so far and critique the way i have written everything and look at how i structured the code in the project. I just dont want to start any future projects with any bad coding habits that are avoidable.  
 
I will post project or send it to whomever is willing to help me out, whichever is easier.

Thanks,
Dean

 

 

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 Mar 03, 2021 11:01 am

Hi Dean, we can take a look unless there is too much code.
Upload your code or a link to the storage. If you do not want to expose your full code you need to create a short self-contained correct example which does not expose the most of your code but is still buggy. If you do not really care please provide your full code.

dmavro
Posts: 52
Joined: Thu Sep 24, 2020 9:20 pm
Been thanked: 1 time

Re: Newbie question pertaining to API and Cloud Notes

Post by dmavro » Thu Mar 11, 2021 6:10 pm

AndreyR wrote:
Wed Mar 03, 2021 11:01 am
Hi Dean, we can take a look unless there is too much code.
Upload your code or a link to the storage. If you do not want to expose your full code you need to create a short self-contained correct example which does not expose the most of your code but is still buggy. If you do not really care please provide your full code.

Andrey,

Ill post something before weekend starts hopefully. After my last post, as a work around i started making 2 versions of the addon to avoid the issue of having the wrong CSV values being plotted on the wrong subscription. Ill re add the code that was supposed to link the symbol to its correct CSV file and then post it here since im not to worried about exposing my code. Ill also post a link to the project itself. 

Thanks,

Dean

Post Reply