19 December 2022

10 steps to setup your Python Luno trading bots on Microsoft Azure

10 steps to setup your Python Luno trading bots on Microsoft Azure.

Step 1: Create a Virtual Machine for Ubuntu with size = B1s. You may choose the cheapest region, which is East US 2 - refer https://azureprice.net/You do not need any graphical user interface for this Ubuntu.


Step 2: Now, configure the SSH to only allows the public IP address from your computer.

Step 3: Log into that Virtual Machine to remove Python 2.7 and upgrade it to version 3.10 - refer https://www.itsupportwale.com/blog/how-to-upgrade-to-python-3-10-on-ubuntu-18-04-and-20-04-lts/. Remember to install pip too.

Step 4: Now, install MySQL on your Virtual Machine using sudo command - refer https://linuxize.com/post/how-to-install-mysql-on-ubuntu-18-04/.

Step 5: After that, install MySQL Client, MySQL Connector and Luno Python SDK on Python 3.10 inside your Virtual Machine. You might need setuptools as pre-requisites.

Step 6. Deploy the Python scripts for your bots.

Step 7. Check the configurations file.

Step 8. Build the database for your bots, which will be used to store trading information.

Step 9. Use nohup command to execute your Python bots at background.

Step 10. Use ps aux command to check whether your Step 9 has been done correctly or not.

Thanks.

25 October 2022

"Character set 'utf8' unsupported" when you run Python script with MySQL database?

When you run Python script with MySQL database, system gives you this error message:

Character set 'utf8' unsupported


What Do You Need To Do?

pip uninstall mysql-connector-python

15 October 2022

Unable to find resource t64.exe in package pip._vendor.distlib

 Hitting this error message "Unable to find resource t64.exe in package pip._vendor.distlib" when trying to upgrade your PIP to latest version?


Try to run the commands below:

  • python -m pip uninstall pip setuptools
  • pip install --upgrade setuptools


Source: https://www.cnblogs.com/poloyy/p/12966270.html

18 September 2022

Supplied javaHome is not a valid folder. You supplied:

You hit this error message on Visual Studio Code (or Android Studio) for your IonicFramework project after you upgraded Java in your computer:

Supplied javaHome is not a valid folder. You supplied: <folder_name_with_path>


What Is The Solution?

a). Make sure Android Studio > Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK is pointing to the correct JDK version. Save all for changes.

b). For Windows, go to this folder "C:\Users\<your_Windows_user_name>\.gradle", delete all of the files and folders.

c). Go to "<your_project_folder>\android\.gradle" folder, delete all of the files and folders.

d). Run the commands below as usual:

ionic build 

npx cap copy

npx cap sync

npx cap open android

19 March 2022

How to open an URL in Chrome incognito mode using Python?

You may refer to the sample codes below from us. We use Windows platform as an example:


import webbrowser

def main():
    fUrl: str = 'https://prgexp.blogspot.com/'

    chrome_path = 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'
    webbrowser.register('chrome', None, webbrowser.BackgroundBrowser(chrome_path))
    webbrowser.get('chrome').args.append('--incognito')
    webbrowser.get('chrome').open_new_tab(fUrl)

if __name__ == '__main__':
    main()

Do I need public IP for Azure VM?

 If you need to connect to your Azure VM from internet (means your home or your office), then yes, you will need to assign a public IP to your Azure VM.

If you prefer to access your Azure VM from Azure Portal, then you may not need any public IP.

More details at this article from Microsoft: https://docs.microsoft.com/en-us/azure/virtual-network/ip-services/associate-public-ip-address-vm


Tips: You can save money if you do not assign any public IP on your Azure VM.