Announcement

Collapse
No announcement yet.

More PowerBasic or learn Python

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • More PowerBasic or learn Python

    Hello,

    I have been working with different dialects of BASIC, ending with Powerbasic 9.03. I can easily write basic code to do whatever I want the program to accomplish.

    I am a stock market trader, also use a language called EasyLanguage to code trading algos.

    My question was: After many years of not actively coding in PB, I now wish to start writing code for different trading applications. These are mainly meant for my own use.

    Should I stick with PB, learn more about it, or shift to a more modern language like Python (with all the learning curve associated with anything new)

    Any thoughts, ideas suggestions would be welcome.


  • #2
    Hi Sudarshan
    I suggest you should do both that is continue with PB and learn up Python, one programming language isn't enough

    Comment


    • #3
      Thanks, Tim. Very sensible advice. I will continue with PB and learn Python on the side.

      Comment


      • #4
        If it can be done in real-time to an excel spreadsheet it can be done with PowerBASIC:
        I would work on getting a feed and later learn the other languages.
        If it requires com then there should be some Jose Roca code.
        https://www.quora.com/Is-there-any-w...-data-in-excel

        Comment


        • #5
          Shift to Python (with all the learning curve associated with anything new). Python is almost crossplatform so you can benefit from Windows to Linux from it.
          If something must done the proper way you must do it yourself.

          Comment


          • #6
            Do due needs arising, I started learning Python myself and I find it to be a mess.

            Given the choice, I suggest giving VB.NET (or C# is you feel venturing off of the BASIC road) a try. The whole Visual Studio is free (Community edition). Add ASP.NET to the mix, try to keep your code .NET Core compatible and your programs (and web stuff) will run on Windows and Linux without modifications.

            Comment


            • #7
              From Sudarshan Sukhani
              Hello,
              I have been working with different dialects of BASIC, ending with Powerbasic 9.03. I can easily write basic code to do whatever I want the program to accomplish.
              I am a stock market trader, also use a language called EasyLanguage to code trading algos.
              My question was: After many years of not actively coding in PB, I now wish to start writing code for different trading applications. These are mainly meant for my own use.
              Should I stick with PB, learn more about it, or shift to a more modern language like Python (with all the learning curve associated with anything new)
              Any thoughts, ideas suggestions would be welcome.
              Noticed this is written in C and has examples for VB and VB.NET so headers can be created (if not already available.)
              Might also startup in VB6 or VB.NET and call this or something like this and your PB code compiled into a DLL
              If you stick with PB your new code can be compiled into a DLL for use with other languages (consider adjustments for C callers.)
              https://www.fmlabs.com/products.htm
              https://www.fmlabs.com/toolkitfaq.htm#Q6

              Comment


              • #8
                I make my living writing single page web apps and use PB for all the back end stuff. PBCC is an incredibly powerful programming tool. The only limitation is that I have to use a Windows web server but really that's not a big deal. Did you know Python and PB came out in the same year (1989)? I also do a fair amount of work in Py when I need to but prefer PB.

                Comment


                • #9
                  I just started Python programming.
                  Python is so slow!

                  Comment


                  • #10
                    Python is so slow!
                    Compared to other interpreters???
                    Dale

                    Comment


                    • #11
                      Originally posted by Marcel Kollenaar View Post
                      Shift to Python (with all the learning curve associated with anything new). Python is almost crossplatform so you can benefit from Windows to Linux from it.
                      Since this is a website SUPPORTED AND RUN BY THE OWNER of PowerBASIC I doubt they would approve of this message and expect it might run afoul (indirectly) of the NO-SPAM forum rules.

                      Personally, using BOTH languages extensively, I find PowerBASIC much FASTER and EASIER to use.

                      <b>George W. Bleck</b>
                      <img src='http://www.blecktech.com/myemail.gif'>

                      Comment


                      • #12
                        Hi George
                        How do you use Python program to call a PB dll ? It would be interesting to do that as you will have existing pb programs
                        and converting it to python can be time consuming

                        Comment


                        • #13
                          What does ability to call (procedures in) a DLL have to do with an existing program? Just use the existing program. Are the procedures in the existing program EXPORTed? (probably not)

                          If the object is to run in a different operating system then converting (rewrite in another language) will be required anyway.
                          Dale

                          Comment


                          • #14
                            Simple example...

                            PB v10.04 Code
                            Code:
                            #COMPILE DLL "PB_PY.dll"
                            #INCLUDE "Win32API.inc"
                            
                            '----------------------------------------------------------------------------(')
                            
                            SUB MLMB( BYREF v_strzText AS WSTRINGZ ) EXPORT
                            	LOCAL v_strTemp AS WSTRING
                            	v_strTemp = v_strzText
                            	REPLACE "|" WITH $CRLF IN v_strTemp
                            	MESSAGEBOX %HWND_DESKTOP,( v_strTemp ), "Message", %MB_OK
                            END SUB
                            
                            '----------------------------------------------------------------------------(')
                            
                            FUNCTION LIBMAIN( _
                            				BYVAL hInstance AS DWORD, _
                            				BYVAL lReason AS LONG, _
                            				BYVAL lReserved AS LONG ) AS LONG
                            	SELECT CASE AS LONG lReason
                            		CASE %DLL_PROCESS_ATTACH
                            			LIBMAIN = 1
                            			EXIT FUNCTION
                            		CASE %DLL_PROCESS_DETACH
                            			EXIT FUNCTION
                            		CASE %DLL_THREAD_ATTACH
                            			EXIT FUNCTION
                            		CASE %DLL_THREAD_DETACH
                            			EXIT FUNCTION
                            	END SELECT
                            END FUNCTION
                            Python 32bit v3.8.5
                            Code:
                            from ctypes import *
                            pblib = CDLL('Drive:/Path/To/Dll/PB_PY.dll')
                            pblib.MLMB('Hello|World')
                            <b>George W. Bleck</b>
                            <img src='http://www.blecktech.com/myemail.gif'>

                            Comment


                            • #15
                              I thought that I had landed at the wrong forum. 193 active members and the last newest member joining over three months ago and here we are talking about Linux and Python in the Programming forum.

                              "Shift to Python" writes a member who has managed to knock out 10 posts in 12 years. If Bob was still around 11 posts would be an impossibility.

                              Maybe Adam Drake is on holiday.

                              Comment


                              • #16
                                Thank you George
                                Python's coding has such a small footprint

                                I wonder if we can use a Python 64bit to call a PB dll ?
                                I think shelling a PB exe program is feasible but not calling a PB dll

                                Comment


                                • #17
                                  I tried Python, but backed away from it. The lack of any meaningfull strong data typing is something I don't want to deal with again. I'm refocusing my learning to the .NET set of tools, especially since MS is pushing .NET Core hard lately, along with ASP.NET Core and PowerShell Core.

                                  The reason for chosing a language like Python would have been it's OS independence, i.e. being able to code for Linux environments, too. But given the above, one can stay within a familiar environemnt and still have that benefit.

                                  Comment


                                  • #18
                                    Originally posted by Tim Lakinir View Post
                                    Python's coding has such a small footprint

                                    I wonder if we can use a Python 64bit to call a PB dll ?
                                    I think shelling a PB exe program is feasible but not calling a PB dll
                                    PB Syntax is just as small, to call the same DLL from a PB Program is...

                                    Code:
                                    DECLARE SUB MLMB LIB "PB_PY.DLL" ALIAS "MLMB" ( BYREF v_strzText AS WSTRINGZ )
                                    MLMB "Hello|World"
                                    As for (ANY) 32bit DLL from 64bit Python Script... NO (Windows Limitation, not PB or Python)
                                    <b>George W. Bleck</b>
                                    <img src='http://www.blecktech.com/myemail.gif'>

                                    Comment


                                    • #19
                                      Originally posted by Tim Lakinir View Post
                                      Python's coding has such a small footprint
                                      Small if you ignore the files you need to have installed to run a python script.

                                      Comment


                                      • #20
                                        IMNSHO you should only invest in learning a new language if you plan on becoming a professional programmer.

                                        Because, in your own words, "I can easily write basic code to do whatever I want the program to accomplish."

                                        Um, that and make one extra backup of your PB compiler installation!

                                        You can reconsider at such time as you can no longer easily write the programs you need.
                                        Michael Mattias
                                        Tal Systems (retired)
                                        Port Washington WI USA
                                        [email protected]
                                        http://www.talsystems.com

                                        Comment

                                        Working...
                                        X