PaulSquires / TradeTracker

Stocks, Futures and Options positions and market portfolio tracker (includes optional Interactive Brokers IBKR TWS API integration)
https://www.tradetracker.planetsquires.com
MIT License
54 stars 9 forks source link

Cross platform for Windows, macOS, and Linux? #45

Open tomasplanicka opened 3 weeks ago

tomasplanicka commented 3 weeks ago

Hi, thanks for your work! I could not figure out how to run it on macOS, the cloned repo looks Windows only?

PaulSquires commented 3 weeks ago

Yes, the main readme of the repo has a message there from Oct 27 that states that the cross platform is about 95% complete. I have rewritten the program using Dear Imgui. I use it daily on Linux (Fedora Workstation) with my real life IBKR account. I tested the program under a macOS (Ventura) virtual machine and it seems to work. It also works well under Windows 10/11.

I am currently finalizing the addition of a new feature that I wanted for a long time. Displaying the real time Delta of Option legs of an existing Trade. Once that is working perfectly then I will finalize the binaries for Windows, macOS and Linux and post them here in this repository. I will also then update the repository to replace the existing Win32 api code base to the cross platform version (I'll put the old WinAPI code in an archive folder within the repository).

Once released, it will be great for you to test the MacOS version because I do not have any dedicated Apple hardware (only the virtual machine that I mentioned above).

tomasplanicka commented 3 weeks ago

Sounds great, thanks for your response! I would like to help with testing once its time to do it

agrieco commented 1 week ago

Sounds great, thanks for your response! I would like to help with testing once its time to do it

likewise

PaulSquires commented 1 week ago

Awesome, thanks for volunteering to test the macOS version. I will put together a package and post a link here for you folks to try. I will try to do as much testing myself but I am NOT a mac/Apple user so hopefully any suggestions you have would be very welcome. Stay tuned, I'll try to get a package together and update the documentation so you're not totally lost when using the program.

PaulSquires commented 1 week ago

Here is the TradeTracker dmg installation file for macOS. I have never made such a file before but I tested it and it seems to install correctly, run, and connect to TWS (when TWS is running). https://www.planetsquires.com/files/TradeTracker.dmg

Here is some preliminary documentation that is unfinished but should get you started: https://www.tradetracker.planetsquires.com/newdocs/index.html

Good luck! Please let me know your results, good and bad.

agrieco commented 1 week ago

Here is the TradeTracker dmg installation file for macOS. I have never made such a file before but I tested it and it seems to install correctly, run, and connect to TWS (when TWS is running). https://www.planetsquires.com/files/TradeTracker.dmg

Here is some preliminary documentation that is unfinished but should get you started: https://www.tradetracker.planetsquires.com/newdocs/index.html

Good luck! Please let me know your results, good and bad.

Its crashing on startup. A few things:

1) it is compiled for Intel silicon. My machine (and new ones) are all Apple (arm) silicon. I wonder if there is an option to compile it that way?

2) seems to be missing a library. No idea if that is because of it running in Rosetta (the x86 emulation layer) or not.

Termination Reason: Namespace DYLD, Code 1 Library missing Library not loaded: /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib Referenced from: <499517F6-8F8E-3F18-8E13-A476B16443BD> /private/var/folders/*/TradeTracker.app/Contents/MacOS/TradeTracker Reason: tried: '/usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib' (no such file), '/usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib' (no such file), '/usr/local/lib/libSDL2-2.0.0.dylib' (no such file), '/usr/lib/libSDL2-2.0.0.dylib' (no such file, not in dyld cache) (terminated at launch; ignore backtrace)

PaulSquires commented 1 week ago

Thanks for the quick update. I can't produce an ARM version for your M series of macs so hopefully I can get the emulated Intel version working first. I'll have to buy a M chip based mac soon in order to get a native version built.

The error message implies that it is trying to load the dynamic library for the SDL graphics. I thought, probably incorrectly, that I statically linked to SDL, so I'll have to check that.

Nothing better than your first experience being a full blown crash and burn 😁😁

PaulSquires commented 1 week ago

Until I get the static linking figured out, you could try installing SDL2 to see if TradeTracker will then pick up the dynamic library.

Using Homebrew package manager:

brew install sdl2-rosetta

(at least this is the advice Google / ChatGPT gives for adding SDL2 support to silicon macs)

No worries though if you prefer not to screw around with your system.

PaulSquires commented 1 week ago

I installed the TradeTracker.dmg on a fresh install of maxOS Sonoma and got the same error that you reported regarding the missing dynamic library for SDL2.

I will try to create a new install that packages the SDL2 code as a static library. I'll will post here again once I can share a new dmg download.

PaulSquires commented 1 week ago

Good news, I was able to compile a new version using static linking for the SDL2 library. It works on my test machine and connects to TWS and displays position information.

Here is the download (same link as before but new file): https://www.planetsquires.com/files/TradeTracker.dmg

You will have to wait until market opens tomorrow for the Options deltas to populate. Likewise, some positions and stock prices may not populate tonight because the market is closed.

Please let me know if you have success with this version.

PaulSquires commented 1 week ago

It does look like I need to modify the code to save the data files elsewhere. Having never used MacOS before, I was unsure where applications save their data files. The current version of TradeTracker saves its data alongside its executable file (in the "Applications" folder). This seems to work and is maybe good enough.

From what I read, I should be saving the files in: ~/Library/Application Support/TradeTracker

I'll have to make that change.

PaulSquires commented 1 week ago

Made a small change to the code so that the application's data files are now saved in: files in: ~/Library/Application Support/TradeTracker

Here is the download (same link as before but new file): https://www.planetsquires.com/files/TradeTracker.dmg

PaulSquires commented 1 week ago

@agrieco @tomasplanicka

If you try the new MacOS version then I would be interested to hear if it is good, bad, or ugly.

agrieco commented 1 week ago

Got it running. It connected to TWS. Now...I just got to read back up on what to do next! ;-)

Thank you for making this happen. Looking forward to digging in from here.

PaulSquires commented 1 week ago

Excellent! That is great news. Hopefully there won't be any/many encountered problems.