diff --git a/armandarmand/.gitignore b/armandarmand/.gitignore new file mode 100644 index 00000000..4456cc24 --- /dev/null +++ b/armandarmand/.gitignore @@ -0,0 +1 @@ +chrome-win diff --git a/armandarmand/gitUpdate.bat b/armandarmand/gitUpdate.bat new file mode 100644 index 00000000..cbeae058 --- /dev/null +++ b/armandarmand/gitUpdate.bat @@ -0,0 +1,7 @@ +git status . + +@pause + +git add . +git commit -m"update armandarmand," +start git push \ No newline at end of file diff --git a/armandarmand/meta.md b/armandarmand/meta.md new file mode 100644 index 00000000..4759ff07 --- /dev/null +++ b/armandarmand/meta.md @@ -0,0 +1,12 @@ +--- +tags: [vba, excel, stock-monitor] +--- + +# armandarmand + +[task1](./task1/meta.md) + +## balance history + +HKD 800 task1 +HKD 100 for highlight modification diff --git a/armandarmand/task1/.gitattributes b/armandarmand/task1/.gitattributes new file mode 100644 index 00000000..f072cdac --- /dev/null +++ b/armandarmand/task1/.gitattributes @@ -0,0 +1 @@ +*.zip filter=lfs diff=lfs merge=lfs -text diff --git a/armandarmand/task1/delivery/_archive/ThisWorkbook.cls b/armandarmand/task1/delivery/_archive/ThisWorkbook.cls new file mode 100644 index 00000000..6b09ce9b --- /dev/null +++ b/armandarmand/task1/delivery/_archive/ThisWorkbook.cls @@ -0,0 +1,5 @@ +Option Explicit + +Sub helloworld() + Worksheets ("Sheet1") +End Sub diff --git a/armandarmand/task1/delivery/_archive/main - Copy.xlsm b/armandarmand/task1/delivery/_archive/main - Copy.xlsm new file mode 100644 index 00000000..1d4d0200 Binary files /dev/null and b/armandarmand/task1/delivery/_archive/main - Copy.xlsm differ diff --git a/armandarmand/task1/delivery/_archive/main-single-thread.xlsm b/armandarmand/task1/delivery/_archive/main-single-thread.xlsm new file mode 100644 index 00000000..e9c43565 Binary files /dev/null and b/armandarmand/task1/delivery/_archive/main-single-thread.xlsm differ diff --git a/armandarmand/task1/delivery/_archive/main-working.xlsm b/armandarmand/task1/delivery/_archive/main-working.xlsm new file mode 100644 index 00000000..8ed8f66d Binary files /dev/null and b/armandarmand/task1/delivery/_archive/main-working.xlsm differ diff --git a/armandarmand/task1/delivery/edit.bat b/armandarmand/task1/delivery/edit.bat new file mode 100644 index 00000000..3f2f847d --- /dev/null +++ b/armandarmand/task1/delivery/edit.bat @@ -0,0 +1,3 @@ +rmdir *.bas + +xlwings vba edit --file .\main.xlsm diff --git a/armandarmand/task1/delivery/main.xlsm b/armandarmand/task1/delivery/main.xlsm new file mode 100644 index 00000000..5880eb6e Binary files /dev/null and b/armandarmand/task1/delivery/main.xlsm differ diff --git a/armandarmand/task1/meta.md b/armandarmand/task1/meta.md new file mode 100644 index 00000000..0f2a2e9a --- /dev/null +++ b/armandarmand/task1/meta.md @@ -0,0 +1,3 @@ +# client working directory + +C:\Users\user\OneDrive\Desktop\delivery diff --git a/armandarmand/task1/task1-ticket1/.editorconfig b/armandarmand/task1/task1-ticket1/.editorconfig new file mode 100644 index 00000000..61451791 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/.editorconfig @@ -0,0 +1,15 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = false + +[*.md] +trim_trailing_whitespace = false diff --git a/armandarmand/task1/task1-ticket1/.gitignore b/armandarmand/task1/task1-ticket1/.gitignore new file mode 100644 index 00000000..2d764b42 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/.gitignore @@ -0,0 +1,3 @@ +node_modules +**/~* +*.del \ No newline at end of file diff --git a/armandarmand/task1/task1-ticket1/.prettierrc b/armandarmand/task1/task1-ticket1/.prettierrc new file mode 100644 index 00000000..5b3a50ab --- /dev/null +++ b/armandarmand/task1/task1-ticket1/.prettierrc @@ -0,0 +1,18 @@ +{ + "arrowParens": "avoid", + "bracketSpacing": true, + "htmlWhitespaceSensitivity": "strict", + "insertPragma": false, + "jsxBracketSameLine": false, + "jsxSingleQuote": false, + "printWidth": 120, + "proseWrap": "preserve", + "quoteProps": "as-needed", + "requirePragma": false, + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "all", + "useTabs": false, + "overrides": [] +} diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/CloudBrowserStack/CloudBrowserStack.xlsm b/armandarmand/task1/task1-ticket1/_ref/Excel/CloudBrowserStack/CloudBrowserStack.xlsm new file mode 100644 index 00000000..42e8d67a Binary files /dev/null and b/armandarmand/task1/task1-ticket1/_ref/Excel/CloudBrowserStack/CloudBrowserStack.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/CloudBrowserStack/dev.bat b/armandarmand/task1/task1-ticket1/_ref/Excel/CloudBrowserStack/dev.bat new file mode 100644 index 00000000..d64ea8d4 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/CloudBrowserStack/dev.bat @@ -0,0 +1,5 @@ +@REM start excel by yourself + +@REM ./test.xlsm + +xlwings vba edit --file ./test.xlsm diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/CloudSauceLab/CloudSauceLab.xlsm b/armandarmand/task1/task1-ticket1/_ref/Excel/CloudSauceLab/CloudSauceLab.xlsm new file mode 100644 index 00000000..fa898f22 Binary files /dev/null and b/armandarmand/task1/task1-ticket1/_ref/Excel/CloudSauceLab/CloudSauceLab.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/CloudSauceLab/dev.bat b/armandarmand/task1/task1-ticket1/_ref/Excel/CloudSauceLab/dev.bat new file mode 100644 index 00000000..d64ea8d4 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/CloudSauceLab/dev.bat @@ -0,0 +1,5 @@ +@REM start excel by yourself + +@REM ./test.xlsm + +xlwings vba edit --file ./test.xlsm diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/Examples.xlsm b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/Examples.xlsm new file mode 100644 index 00000000..75ebf027 Binary files /dev/null and b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/Examples.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/ThisWorkbook.cls b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/ThisWorkbook.cls new file mode 100644 index 00000000..d38f24ad --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/ThisWorkbook.cls @@ -0,0 +1,537 @@ + + + + + + + + +Private Sub Workbook_Open() + + + + + + + + 'Opens the VBA Editor + + + + + + + + 'Call Open_VBA_Editor + + + + + + + +End Sub + + + + + + + + + + + + + + + + + + + + + + + +Private Sub Open_VBA_Editor() + + + + + + + + Application.CommandBars.FindControl(ID:=1695).Execute + + + + + + + +End Sub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_all.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_all.bas new file mode 100644 index 00000000..6c8ec0dd --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_all.bas @@ -0,0 +1,63 @@ +Attribute VB_Name = "browsers_all" +' This module contains examples on how to work +' with a specific browser. +' + + +Private Sub Use_Chrome() + Dim driver As New ChromeDriver + driver.Get "https://www.google.co.uk" + driver.Quit +End Sub + + +Private Sub Use_Firefox() + Dim driver As New ChromeDriver + driver.Get "https://www.google.co.uk" + driver.Quit +End Sub + + +Private Sub Use_Opera() + Dim driver As New OperaDriver + driver.Get "https://www.google.co.uk" + driver.Quit +End Sub + + +Private Sub Use_InternetExplorer() + Dim driver As New IEDriver + driver.Get "https://www.google.co.uk" + driver.Quit +End Sub + + +Private Sub Use_PhantomJS() + Dim driver As New PhantomJSDriver + driver.Get "https://www.google.co.uk" + driver.Quit +End Sub + + +Private Sub Use_FirefoxLight() + ' Firefox Light: + ' http://sourceforge.net/projects/lightfirefox/ + + Dim driver As New ChromeDriver + driver.SetBinary "C:\...\light.exe" + driver.Get "https://www.google.co.uk" + driver.Quit +End Sub + + +Private Sub Use_CEF() + ' Chromium Embedded Framework: + ' https://cefbuilds.com + + Dim driver As New ChromeDriver + driver.SetBinary "C:\...\cefclient.exe" + driver.AddArgument "url=data:," + driver.Get "https://www.google.co.uk" + driver.Quit +End Sub + diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_debug.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_debug.bas new file mode 100644 index 00000000..e1230231 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_debug.bas @@ -0,0 +1,40 @@ +Attribute VB_Name = "browsers_debug" +' This module contains examples on how to work with +' a Chrome based browser that was launched with a +' listening debug port. +' + + +Private Sub Connect_To_Chrome() + 'Use this command line to launch the browser: + 'chrome.exe -remote-debugging-port=9222 + + Dim driver As New ChromeDriver + driver.SetCapability "debuggerAddress", "127.0.0.1:9222" + driver.Get "https://en.wikipedia.org" + driver.Quit +End Sub + + +Private Sub Connect_To_CFE() + 'Chromium Embedded Framework: https://cefbuilds.com/ + 'Use this command line to launch the browser: + 'cefclient.exe -remote-debugging-port=9333 -url=data:, + + Dim driver As New ChromeDriver + driver.SetCapability "debuggerAddress", "127.0.0.1:9333" + driver.Get "https://en.wikipedia.org" + driver.Quit +End Sub + + +Private Sub Connect_To_Firefox() + 'Firefox must have the WebDriver extension installed: + '%USERPROFILE%\AppData\Local\SeleniumBasic\ChromeDriver.xpi + 'To use another port, set the preference webdriver_firefox_port in about:config + + Dim driver As New ChromeDriver + driver.SetCapability "debuggerAddress", "127.0.0.1:7055" + driver.Get "https://en.wikipedia.org" +End Sub + diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_extension.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_extension.bas new file mode 100644 index 00000000..b1e4af44 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_extension.bas @@ -0,0 +1,33 @@ +Attribute VB_Name = "browsers_extension" +' This module contains examples on how to work with +' an extension. +' + + +Private Sub Use_Chrome_With_Extension() + ' To download an extension: + ' http://chrome-extension-downloader.com + ' To manage the extension preferences: + ' Developper Tools > Resources > Local Storage > chrome-extension://... + + Dim driver As New ChromeDriver + driver.AddExtension "C:\Users\florent\Downloads\Personal-Blocklist-(by-Google)_v2.6.1.crx" + driver.SetPreference "plugins.plugins_disabled", Array("Adobe Flash Player") + driver.Get "chrome-extension://nolijncfnkgaikbjbdaogikpmpbdcdef/manager.html" + driver.ExecuteScript "localStorage.setItem('blocklist', '[""wikipedia.org""]');" + + driver.Get "https://www.google.co.uk" + driver.Quit +End Sub + + +Private Sub Use_Firefox_With_Extension() + ' To download an extension, use a browser other than Firefox + + Dim driver As New ChromeDriver + driver.AddExtension "C:\Users\florent\Downloads\firebug-2.0.12-fx.xpi" + driver.SetPreference "extensions.firebug.showFirstRunPage", False + + driver.Get "https://www.google.co.uk" + driver.Quit +End Sub diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_profile.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_profile.bas new file mode 100644 index 00000000..8efa6ca9 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_profile.bas @@ -0,0 +1,52 @@ +Attribute VB_Name = "browsers_profile" +' This module contains examples on how to work with +' a customized profile. +' + + +Private Sub Use_Chrome_With_Custom_profile_name() + ' Profiles folder : %APPDATA%\Google\Chrome\Profiles + ' Note that with Chrome the profile is always persistant + + Dim driver As New ChromeDriver + driver.SetProfile "Selenium" + + driver.Get "https://www.google.co.uk" + driver.Quit +End Sub + +Private Sub Use_Chrome_With_Custom_profile_path() + ' Default profile : %LOCALAPPDATA%\Google\Chrome\User Data + ' Profiles folder : %APPDATA%\Google\Chrome\Profiles + ' Note that with Chrome the profile is always persistant + + Dim driver As New ChromeDriver + driver.SetProfile "%LOCALAPPDATA%\Google\Chrome\User Data" + + driver.Get "https://www.google.co.uk" + driver.Quit +End Sub + +Private Sub Use_Firefox_With_Custom_profile_name() + ' To manage firefox profiles: firefox -p + ' Profiles folder: %APPDATA%\Mozilla\Firefox\Profiles + ' When persistant is False, the driver works with a copy in the Temp folder. + + Dim driver As New ChromeDriver + driver.SetProfile "Selenium", persistant:=True + + driver.Get "https://www.google.co.uk" + driver.Quit +End Sub + +Private Sub Use_Firefox_With_Custom_profile_path() + ' To manage the profiles: firefox -p + ' Profiles folder: %APPDATA%\Mozilla\Firefox\Profiles + ' When persistant is False, the driver works with a copy in the Temp folder. + + Dim driver As New ChromeDriver + driver.SetProfile "%APPDATA%\Mozilla\Firefox\Profiles\kfvj49h4.Selenium", persistant:=True + + driver.Get "https://www.google.co.uk" + driver.Quit +End Sub diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_remote.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_remote.bas new file mode 100644 index 00000000..3079a2e6 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_remote.bas @@ -0,0 +1,25 @@ +Attribute VB_Name = "browsers_remote" +' This module contains examples on how to work with +' a browser installed on another station. +' +' Selenium Standalone Server: +' http://www.seleniumhq.org/download/ +' +' Command line to start the server: +' java -jar selenium-server-standalone-2.47.1.jar +' + +Const SERVER = "http://127.0.0.1:4444/wd/hub" + +Private Sub Take_ScreenShot_Remotely() + Dim driver As New WebDriver + driver.StartRemotely SERVER, "safari" + 'open the page with the URL in Sheet3 in cell A2 + driver.Get [Sheet3!A4] + + 'Take the screenshoot + driver.TakeScreenshot().ToExcel [Sheet3!A7] + + driver.Quit +End Sub + diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_running.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_running.bas new file mode 100644 index 00000000..be5c013a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_running.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "browsers_running" +' This module shows how to work with a running instance of +' a driver by using the GetObject function. +' +' To do so, create a vbs file with the following code and run it. +' +' Set driver = CreateObject("Selenium.ChromeDriver") +' driver.Start +' WScript.Echo "Click OK to quit" +' + + +Public Sub OpenURL() + Dim driver As WebDriver + Set driver = GetObject("Selenium.WebDriver") + driver.Get "https://www.google.co.uk" +End Sub diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_static.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_static.bas new file mode 100644 index 00000000..ad278399 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/browsers_static.bas @@ -0,0 +1,30 @@ +Attribute VB_Name = "browsers_static" +' This module contains is an example on how to use +' the same instance of a browser with different +' procedures. +' + +Private driver As New Selenium.ChromeDriver +Private Assert As New Selenium.Assert +Private Verify As New Selenium.Verify +Private Waiter As New Selenium.Waiter +Private utils As New Selenium.utils +Private Keys As New Selenium.Keys +Private By As New Selenium.By + + +Public Sub NavigateToURL1() + driver.Get [Sheet4!B2] +End Sub + + +Public Sub NavigateToURL2() + driver.Get [Sheet4!B5] +End Sub + + +Public Sub QuitDriver() + driver.Quit + Set driver = Nothing +End Sub + diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/dev.bat b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/dev.bat new file mode 100644 index 00000000..73b9dfcc --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/dev.bat @@ -0,0 +1,5 @@ +@REM start excel by yourself + +@REM ./test.xlsm + +xlwings vba edit --file ./Examples.xlsm diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/example_amazon.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/example_amazon.bas new file mode 100644 index 00000000..8a42821b --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/example_amazon.bas @@ -0,0 +1,36 @@ +Attribute VB_Name = "example_amazon" + +Const css_input = "#twotabsearchtextbox" +Const css_spinner = "#centerBelowPlusspacer" +Const css_titles = "#s-results-list-atf a.s-access-detail-page" +Const css_bt_next = "#pagnNextLink #pagnNextString" + +Private Sub Search_Amazon() + Const search_input = "drum carrot" + + Dim driver As New ChromeDriver + driver.Get "http://www.amazon.com/s" + + ' type in the field and submit + driver.FindElementByCss(css_input) _ + .SendKeys(search_input) _ + .Submit + + Dim By As New By + Do + ' wait for the loading bar to disapear + driver.WaitNotElement By.css(css_spinner), 7000 + + ' handle results + For Each ele In driver.FindElementsByCss(css_titles) + Debug.Print ele.Text + Next + + ' click next page or exit the loop if the link is not present + Set bt_next = driver.FindElementByCss(css_bt_next, timeout:=0, Raise:=False) + If bt_next Is Nothing Then _ + Exit Do + bt_next.Click + Loop +End Sub + diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_alert.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_alert.bas new file mode 100644 index 00000000..851dfa15 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_alert.bas @@ -0,0 +1,33 @@ +Attribute VB_Name = "usage_alert" +Private Assert As New Selenium.Assert + + +Private Sub Handle_Alerts() + Dim driver As New ChromeDriver + driver.SetCapability "unexpectedAlertBehaviour", "ignore" + driver.Get "http://the-internet.herokuapp.com/javascript_alerts" + + ' Display alert + driver.FindElementByCss("#content li:nth-child(2) button").Click + + ' Set the context on the alert dialog + Set dlg = driver.SwitchToAlert(Raise:=False) + + ' Assert an alert is present and the message + Assert.False dlg Is Nothing, "No alert present!" + Assert.Equals "I am a JS Confirm", dlg.Text + + ' Close alert + dlg.Accept + + driver.Quit +End Sub + + +'Returns true if an alert is present, false otherwise +' driver: web driver +Private Function IsDialogPresent(driver As WebDriver) As Boolean + On Error Resume Next + T = driver.title + IsDialogPresent = (26 = Err.Number) +End Function diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_authentication.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_authentication.bas new file mode 100644 index 00000000..88c93342 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_authentication.bas @@ -0,0 +1,68 @@ +Attribute VB_Name = "usage_authentication" +Private Assert As New Selenium.Assert + + +Private Sub Basic_Authentication_In_URL() + Dim driver As New IEDriver + driver.Get "http://admin:admin@the-internet.herokuapp.com/basic_auth" + + txt = driver.FindElementByCss(".example p").Text + Assert.Matches "^Congratulations!", txt + + driver.Quit +End Sub + + +Private Sub AuthenticationDialog_Selenium() + Dim driver As New IEDriver + driver.Get "http://the-internet.herokuapp.com/basic_auth" + + Dim dlg As Alert: Set dlg = driver.SwitchToAlert(Raise:=False) + If Not dlg Is Nothing Then + dlg.SetCredentials "admin", "admin" + dlg.Accept + End If + + txt = driver.FindElementByCss(".example p").Text + Assert.Matches "^Congratulations!", txt + driver.Quit +End Sub + + +Private Sub AuthenticationDialog_WScript() + Dim driver As New IEDriver + driver.Get "http://the-internet.herokuapp.com/basic_auth" + + Dim dlg As Alert: Set dlg = driver.SwitchToAlert(Raise:=False) + If Not dlg Is Nothing Then + Set wsh = CreateObject("WScript.Shell") + wsh.SendKeys "admin" + wsh.SendKeys "{TAB}" + wsh.SendKeys "admin" + dlg.Accept + End If + + txt = driver.FindElementByCss(".example p").Text + Assert.Matches "^Congratulations!", txt + driver.Quit +End Sub + + +Private Sub AuthenticationDialog_AutoIt() + Dim driver As New IEDriver + driver.Get "http://the-internet.herokuapp.com/basic_auth" + + Dim dlg As Alert: Set dlg = driver.SwitchToAlert(Raise:=False) + If Not dlg Is Nothing Then + Set aut = CreateObject("AutoItX3.Control") + aut.Send "admin" + aut.Send "{TAB}" + aut.Send "admin" + dlg.Accept + End If + + txt = driver.FindElementByCss(".example p").Text + Assert.Matches "^Congratulations!", txt + driver.Quit +End Sub + diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_checkbox.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_checkbox.bas new file mode 100644 index 00000000..1087a73a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_checkbox.bas @@ -0,0 +1,22 @@ +Attribute VB_Name = "usage_checkbox" +Private Assert As New Selenium.Assert + + +Private Sub Handle_Checkbox() + Dim driver As New ChromeDriver + driver.Get "http://the-internet.herokuapp.com/checkboxes" + + 'Get the 2 second checkbox + Dim cs As WebElement + Set cb = driver.FindElementByCss("#checkboxes input:nth-of-type(2)") + + 'Assert the checkbox is checked + Assert.True cb.IsSelected + + 'Uncheck the checkbox + cb.Click + + 'Assert the checkbox is unchecked + Assert.False cb.IsSelected + driver.Quit +End Sub diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_clipboard.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_clipboard.bas new file mode 100644 index 00000000..c260c600 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_clipboard.bas @@ -0,0 +1,14 @@ +Attribute VB_Name = "usage_clipboard" + +Dim Keys As New Selenium.Keys + +Private Sub Paste_ClipBoard() + Dim driver As New Selenium.ChromeDriver + driver.Get "https://en.wikipedia.org/wiki/Main_Page" + + driver.SetClipBoard [b3] + driver.FindElementById("searchInput").SendKeys Keys.Control, "v" + + Debug.Assert 0 + driver.Quit +End Sub diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_cookies.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_cookies.bas new file mode 100644 index 00000000..e31018d9 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_cookies.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "usage_cookies" + +Private Assert As New Selenium.Assert + + +Private Sub Handle_Cookies() + Dim driver As New ChromeDriver + driver.Get "http://admin:admin@the-internet.herokuapp.com/download_secure" + + 'Get a cookie by name + Dim cookie As cookie + Set cookie = driver.Manage.FindCookieByName("rack.session") + Assert.Equals "the-internet.herokuapp.com", cookie.Domain + + 'Stop the browser + driver.Quit +End Sub diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_dom.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_dom.bas new file mode 100644 index 00000000..9df17df0 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_dom.bas @@ -0,0 +1,28 @@ +Attribute VB_Name = "usage_dom" + +Private Sub Get_DOM_1() + Dim driver As New ChromeDriver + driver.Get "https://en.wikipedia.org/wiki/Main_Page" + + Dim html As Object + Set html = CreateObject("htmlfile") + html.Open + html.Write driver.PageSource() + html.Close + + Debug.Print html.body.innerText + driver.Quit +End Sub + + +Private Sub Get_DOM_2() + Dim driver As New ChromeDriver + driver.Get "https://en.wikipedia.org/wiki/Main_Page" + + Dim html As Object + Set html = CreateObject("htmlfile") + html.body.innerHTML = driver.ExecuteScript("return document.body.innerHTML;") + + Debug.Print html.body.innerText + driver.Quit +End Sub diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_download.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_download.bas new file mode 100644 index 00000000..18a90f79 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_download.bas @@ -0,0 +1,378 @@ +Attribute VB_Name = "usage_download" + +Private Declare PtrSafe Function FindWindowExA Lib "user32.dll" ( _ + ByVal hwndParent As LongPtr, _ + ByVal hwndChildAfter As LongPtr, _ + ByVal lpszClass As String, _ + ByVal lpszWindow As String) As Long + +Private Declare PtrSafe Function PostMessageA Lib "user32.dll" ( _ + ByVal hwnd As LongPtr, _ + ByVal wMsg As LongPtr, _ + ByVal wParam As LongPtr, _ + ByVal lParama As LongPtr) As Long + +Private Declare PtrSafe Function GetWindowLongA Lib "user32.dll" ( _ + ByVal hwnd As LongPtr, ByVal nIndex As Integer) As Long + +Private Declare PtrSafe Function AccessibleObjectFromWindow Lib "oleacc.dll" ( _ + ByVal hwnd As LongPtr, _ + ByVal dwId As Long, _ + ByRef riid As Any, _ + ByRef ppvObject As IAccessible) As Long + +Private Declare PtrSafe Function AccessibleChildren Lib "oleacc.dll" ( _ + ByVal paccContainer As IAccessible, _ + ByVal iChildStart As Long, _ + ByVal cChildren As Long, _ + ByRef rgvarChildren As Variant, _ + ByRef pcObtained As Long) As Long + + + + +'' +' Downloads the link defined in the href attribute of a web element +'' +Private Sub Usage_Download_StaticLink() + Dim driver As New IEDriver, ele As WebElement + driver.Get "https://www.mozilla.org/en-US/foundation/documents" + + Set ele = driver.FindElementByLinkText("IRS Form 872-C") + Download_StaticLink ele, ThisWorkbook.Path & "\irs-form-872-c_1.pdf" + + driver.Quit +End Sub + + +'' +' Downloads a file with IE and waits for completion +'' +Private Sub Download_File_IE() + Dim driver As New IEDriver, ele As WebElement + driver.Get "https://www.mozilla.org/en-US/foundation/documents" + + Dim filePath As String + driver.FindElementByLinkText("IRS Form 872-C").ExecuteScript "this.click()" + filePath = DownloadFileSyncIE(ThisWorkbook.Path) + + driver.Quit +End Sub + + +'' +' Downloads a file with IE without waiting for completion +'' +Private Sub Download_File_Asynchrone_IE() + Dim driver As New IEDriver, ele As WebElement + driver.Get "https://www.mozilla.org/en-US/foundation/documents" + + ' Init the file waiter + WaitNewFile ThisWorkbook.Path & "\*.pdf" + + driver.FindElementByLinkText("IRS Form 872-C").ExecuteScript "this.click()" + DownloadFileAsyncIE ThisWorkbook.Path + + ' Waits for a new file + file = WaitNewFile() + + Debug.Assert 0 + driver.Quit +End Sub + +'' +' Sets the download folder with Firefox +'' +Private Sub Download_File_Firefox() + Dim driver As New ChromeDriver, file As String + + 'Set the preferences specific to Firefox + driver.SetPreference "browser.download.folderList", 2 + driver.SetPreference "browser.download.dir", ThisWorkbook.Path + driver.SetPreference "browser.helperApps.neverAsk.saveToDisk", "application/pdf" + driver.SetPreference "pdfjs.disabled", True + + ' Init the file waiter + WaitNewFile ThisWorkbook.Path & "\*.pdf" + + ' Open the file for download + driver.Get "https://www.mozilla.org/en-US/foundation/documents" + driver.FindElementByLinkText("IRS Form 872-C").Click + + ' Waits for a new file + file = WaitNewFile() + + 'Stop the browser + driver.Quit +End Sub + +'' +' Sets the download folder with Chrome +'' +Private Sub Download_File_Chrome() + Dim driver As New ChromeDriver, file As String + + 'Set the preferences specific to Chrome + driver.SetPreference "download.default_directory", ThisWorkbook.Path + driver.SetPreference "download.directory_upgrade", True + driver.SetPreference "download.prompt_for_download", False + driver.SetPreference "plugins.plugins_disabled", Array("Chrome PDF Viewer") + + ' Init the file waiter + WaitNewFile ThisWorkbook.Path & "\*.pdf" + + 'Open the file for download + driver.Get "https://www.mozilla.org/en-US/foundation/documents" + driver.FindElementByLinkText("IRS Form 872-C").Click + + ' Waits for a new file + file = WaitNewFile() + + 'Stop the browser + Debug.Assert 0 + driver.Quit +End Sub + + + + + +' ### HELPERS FUNCTIONS ### + +'' +' Saves the file pointed by the href attribute : Document +' @element {WebElement} Web element with the href link +' @save_as {String} Path were the file is to be saved +'' +Private Sub Download_StaticLink(element As WebElement, save_as As String) + ' Extract the data to build the request (link, user-agent, language, cookie) + Dim info As Selenium.Dictionary + Set info = element.ExecuteScript("return {" & _ + "link: this.href," & _ + "agent: navigator.userAgent," & _ + "lang: navigator.userLanguage," & _ + "cookie: document.cookie };") + + ' Send the request + Static xhr As Object + If xhr Is Nothing Then Set xhr = CreateObject("Msxml2.ServerXMLHTTP.6.0") + xhr.Open "GET", info("link") + xhr.setRequestHeader "User-Agent", info("agent") + xhr.setRequestHeader "Accept-Language", info("lang") + xhr.setRequestHeader "Cookie", info("cookie") + xhr.Send + If (xhr.Status \ 100) - 2 Then Err.Raise 5, , xhr.Status & " " & xhr.StatusText + + ' Save the response to a file + Static bin As Object + If bin Is Nothing Then Set bin = CreateObject("ADODB.Stream") + If Len(Dir$(save_as)) Then Kill save_as + bin.Open + bin.Type = 1 + bin.Write xhr.ResponseBody + bin.Position = 0 + bin.SaveToFile save_as + bin.Close +End Sub + + +'' +' Waits for a new file to be created in a folder +' @folder {String} Folder where the file will be created +' Usage: +' WaitNewFile "C:\download\*.pdf" +' ' The new file is created here +' filename = WaitNewFile() +'' +Public Function WaitNewFile(Optional target As String) As String + Static files As Collection, filter$ + Dim file$, file_path$, i& + If Len(target) Then + ' Initialize the list of files and return + filter = target + Set files = New Collection + file = Dir(filter, vbNormal) + Do While Len(file) + files.Add Empty, file + file = Dir + Loop + Exit Function + End If + + ' Waits for a file that is not in the list + On Error GoTo WaitReady + Do + file = Dir(filter, vbNormal) + Do While Len(file) + files.Item file + file = Dir + Loop + For i = 0 To 3000: DoEvents: Next + Loop + +WaitReady: + ' Waits for the size to be superior to 0 and try to rename it + file_path = Left$(filter, InStrRev(filter, "\")) & file + Do + If FileLen(file_path) Then + On Error Resume Next + Name file_path As file_path + If Err = 0 Then Exit Do + End If + For i = 0 To 3000: DoEvents: Next + Loop + files.Add Empty, file + WaitNewFile = file_path +End Function + + +'' +' Saves the file from the download dialogue, waits for completion and returns the path +' @save_as: folder or file path +'' +Private Function DownloadFileSyncIE(ByVal save_as As String) As String + Const dl_key = "HKCU\Software\Microsoft\Internet Explorer\Main\Default Download Directory" + + Static shl As Object, Waiter As New Waiter + If shl Is Nothing Then + Set shl = CreateObject("WScript.Shell") + shl.RegWrite "HKCU\Software\Microsoft\Internet Explorer\Main\NotifyDownloadComplete", "no", "REG_SZ" + shl.RegWrite "HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_RESTRICT_FILEDOWNLOAD\iexplore.exe", 0, "REG_DWORD" + End If + + Dim ie_hwnd, frm_hwnd, endtime#, i&, n&, folder_bak$, file_name$ + + ' wait for the download dialogue (IEFrame/Frame Notification Bar/DirectUIHWND) + ie_hwnd = FindWindowExA(0, 0, "IEFrame", vbNullString) + endtime = Now + 5000 / 86400# + Do + frm_hwnd = FindWindowExA(ie_hwnd, 0, "Frame Notification Bar", vbNullString) + If frm_hwnd Then + If GetWindowLongA(frm_hwnd, -16) And &H10000000 Then Exit Do ' If visible + End If + If Now > endtime Then Err.Raise 5, , "Failed to find the download dialog" + Waiter.Wait 100 + Loop + + ' save the download folder path and create a temporary folder + tmp_dir = Environ$("TEMP") & "\dl-ie-4f521" + On Error Resume Next + folder_bak = shl.RegRead(dl_key) + MkDir tmp_dir + Kill tmp_dir & "\*" + On Error GoTo 0 + + ' set the download folder in the registry + shl.RegWrite dl_key, tmp_dir, "REG_SZ" + + ' send the shortcut for Save (Alt + S) + Waiter.Wait 500 + PostMessageA ie_hwnd, &H104&, &H12, &H20000001 'WM_SYSKEYDOWN, VK_MENU + PostMessageA ie_hwnd, &H104&, &H53, &H20000001 'WM_SYSKEYDOWN, S + PostMessageA ie_hwnd, &H105&, &H53, &HC0000001 'WM_SYSKEYUP, S + PostMessageA ie_hwnd, &H101&, &H12, &HC0000001 'WM_KEYUP, VK_MENU + + ' wait for the file to be downloaded + Do + Waiter.Wait 100 + file_name = VBA.Dir$(tmp_dir & "\*") + Loop While InStr(Len(file_name) - 8, file_name, ".partial") Or Len(file_name) = 0 + + ' restore the download folder in the registry + If folder_bak = Empty Then + shl.RegDelete dl_key + Else + shl.RegWrite dl_key, folder_bak, "REG_SZ" + End If + + ' delete existing file + If Len(VBA.Dir$(save_as, vbNormal)) Then Kill save_as + If Len(VBA.Dir$(save_as, vbDirectory)) Then + save_as = save_as & "\" & file_name + If Len(VBA.Dir$(save_as, vbNormal)) Then Kill save_as + End If + + ' move the file to the provided path + Name tmp_dir & "\" & file_name As save_as + DownloadFileSyncIE = save_as +End Function + +'' +' Saves the file from the download dialogue without waiting for completion +' @folder: download folder +'' +Private Sub DownloadFileAsyncIE(folder As String) + Const timeout = 5000, bt_save = "Save", bt_close = "Close" + Const dl_key = "HKCU\Software\Microsoft\Internet Explorer\Main\Default Download Directory" + + Static shl As Object, Waiter As New Waiter + If shl Is Nothing Then + Set shl = CreateObject("WScript.Shell") + shl.RegWrite "HKCU\Software\Microsoft\Internet Explorer\Main\NotifyDownloadComplete", "no", "REG_SZ" + shl.RegWrite "HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_RESTRICT_FILEDOWNLOAD\iexplore.exe", 0, "REG_DWORD" + End If + + ' wait for the download dialog (IEFrame/Frame Notification Bar/DirectUIHWND) + Dim ie_hwnd, frm_hwnd, dlg_hwnd, endtime#, folder_bak$, i& + ie_hwnd = FindWindowExA(0, 0, "IEFrame", vbNullString) + endtime = Now + timeout / 86400# + Do + frm_hwnd = FindWindowExA(ie_hwnd, 0, "Frame Notification Bar", vbNullString) + If frm_hwnd Then + If GetWindowLongA(frm_hwnd, -16) And &H10000000 Then Exit Do ' If visible + End If + If Now > endtime Then Err.Raise 5, , "Failed to find the download dialog" + For i = 1 To 5000: DoEvents: Next + Loop + + ' get the save button + Dim acc As IAccessible, bt As IAccessible + dlg_hwnd = FindWindowExA(frm_hwnd, 0, "DirectUIHWND", vbNullString) + Set acc = acc_from_window(dlg_hwnd) + Set bt = acc_find_button(acc, bt_save) + If bt Is Nothing Then Err.Raise 5, , "Failed to find the Save button" + + ' save and set the download folder in the registry + On Error Resume Next + folder_bak = shl.RegRead(dl_key) + On Error GoTo 0 + shl.RegWrite dl_key, folder, "REG_SZ" + + ' click on Save + Waiter.Wait 500 + bt.accDoDefaultAction 0& + Waiter.Wait 100 + + ' restore the download folder in the registry + If folder_bak = Empty Then + shl.RegDelete dl_key + Else + shl.RegWrite dl_key, folder_bak, "REG_SZ" + End If +End Sub + + +Private Function acc_from_window(hwnd) As IAccessible + Dim iid&(0 To 3) + iid(0) = &H618736E0 ' IAccessible interface + iid(1) = &H11CF3C3D + iid(2) = &HAA000C81 + iid(3) = &H719B3800 + AccessibleObjectFromWindow hwnd, 0&, iid(0), acc_from_window +End Function + +Private Function acc_find_button(ByVal acc As IAccessible, name$) As IAccessible + If acc.accName(0&) Like name Then + Set acc_find_button = acc + ElseIf acc.accChildCount > 0 Then + Dim children(0 To 20), count&, i& + AccessibleChildren acc, 0, acc.accChildCount, children(0), count + For i = 0 To count - 1 + If VBA.IsObject(children(i)) Then + Set acc_find_button = acc_find_button(children(i), name) + If Not acc_find_button Is Nothing Then Exit For + End If + Next + End If +End Function + diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_dragdrop.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_dragdrop.bas new file mode 100644 index 00000000..b50dfc56 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_dragdrop.bas @@ -0,0 +1,106 @@ +Attribute VB_Name = "usage_dragdrop" +Private Assert As New Selenium.Assert +Private Keys As New Selenium.Keys +Private By As New Selenium.By + + +Private Sub Perform_DragAndDrop_HTML5() + Dim driver As New ChromeDriver + driver.Get "http://html5demos.com/drag" + + Dim ele_source As WebElement, ele_target As WebElement + Set ele_source = driver.FindElementById("two") + Set ele_target = driver.FindElementById("bin") + + driver.Actions.ClickAndHold(ele_source).MoveToElement(ele_target).Release.Perform + driver.Actions.DragAndDrop(ele_source, ele_target).Perform + + Assert.True ele_source.IsPresent + DragAndDropHTML5 ele_source, ele_target + Assert.False ele_source.IsPresent + + driver.Quit +End Sub + + +Private Sub Perform_DropText_HTML5() + Dim driver As New ChromeDriver + driver.Get "http://html5demos.com/drag-anything" + + Const DROP_TYPE = "text/message" + Dim ele_drop As WebElement + Set ele_drop = driver.FindElementById("drop") + + DropDataHTML5 ele_drop, DROP_TYPE, "my text" + + Assert.Equals "my text", ele_drop.Text + driver.Quit +End Sub + + +Private Sub Perform_DropFile_HTML5() + Dim driver As New ChromeDriver + driver.Get "http://html5demos.com/file-api" + + Dim ele_drop As WebElement + Set ele_drop = driver.FindElementById("holder") + + DropFileHTML5 ele_drop, "file:///C:/Untitled.png" + + driver.Quit +End Sub + + + +' ### HELPERS FUNCTIONS ### + +'' +' Drop data on an element that implements HTML5 drop +' @target: web element that will receive the data +' @dataType: type of data +' @data: data to drop on the target +'' +Private Sub DropDataHTML5(target As WebElement, dataType As String, data) + Const JS_DropText As String = _ + "var t=this,m=arguments[0],v=arguments[1],d={dropEffect:'',types:[m],getData:funct" & _ + "ion(k){return v;}},f=function(e,k){var u=document.createEvent('Event');u.initEven" & _ + "t(k,1,1);u.dataTransfer=d;e.dispatchEvent(u);};f(t,'dragenter');f(t,'dragover');f" & _ + "(t,'drop');" + + target.ExecuteScript JS_DropText, Array(dataType, data) +End Sub + +'' +' Perform a drag and drop on elements that implement HTML5 drag an drop +' @source web element to drag +' @target: web element to drop on +'' +Private Sub DragAndDropHTML5(source As WebElement, target As WebElement) + Const JS_DnD As String = _ + "var s=this,t=arguments[0],d={dropEffect:'',types:[],setData:function(k,v){this[k]=" & _ + "v;types.append(k);},getData:function(k){return this[k]}},f=function(e,k){var u=doc" & _ + "ument.createEvent('Event');u.initEvent(k,1,1);u.dataTransfer=d;e.dispatchEvent(u);" & _ + "};f(s,'dragstart');f(t,'dragenter');f(t,'dragover');f(t,'drop');f(s,'dragend');" + + source.ExecuteScript JS_DnD, target +End Sub + +'' +' Perform a drag and drop on elements that implement HTML5 drag an drop +' @target: web element that will receive the file +' @filepath: file path +'' +Private Sub DropFileHTML5(target As WebElement, filePath As String) + Const JS_NewInput = _ + "var e=document.createElement('input');e.type='file';" & _ + "document.body.appendChild(e);return e;" + Const JS_DropFile = _ + "var s=this,t=arguments[0],d={dropEffect:'',files:s.files},f=function(e,k){u=docum" & _ + "ent.createEvent('Event');u.initEvent(k,1,1);u.dataTransfer=d;e.dispatchEvent(u);}" & _ + ";f(t,'dragenter');f(t,'dragover');f(t,'drop');" + + Dim source As WebElement + Set source = target.ExecuteScript(JS_NewInput) + source.SendKeys filePath + source.ExecuteScript JS_DropFile, target +End Sub diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_excel.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_excel.bas new file mode 100644 index 00000000..e3ce4d09 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_excel.bas @@ -0,0 +1,75 @@ +Attribute VB_Name = "usage_excel" +' This module contains examples to read and write +' data from and to an excel sheet. +' + +Private Table As New Selenium.Table +Private Assert As New Selenium.Assert +Private Verify As New Selenium.Verify +Private Keys As New Selenium.Keys + + +Private Sub Use_Cell_text() + Dim driver As New ChromeDriver + driver.Get "https://en.wikipedia.org/wiki/Main_Page" + + 'get the input box + Dim ele As WebElement + Set ele = driver.FindElementById("searchInput") + + 'Search the text from the cell A3 + ele.SendKeys [b3] + ele.Submit + + driver.Quit +End Sub + +Public Sub VerifyTitles() + Dim driver As New ChromeDriver + + driver.setBinary "C:\tools\chrome-win\chrome.exe" + + Dim row + For Each row In Table.From([Sheet1!A3]).Where("Id > 0") + 'open the page with the link in column "Link" + driver.Get row("Link") + + 'Verify the title and set the result in column "Result" + row("Result") = Verify.Equals(row("ExpectedTitle"), driver.title) + Next + + driver.Quit +End Sub + + +Public Sub ListLinks() + Dim driver As New ChromeDriver + + 'open the page with the URL in cell A2 + driver.Get [Sheet2!A4] + + 'get all the href attributes + Dim links As List + Set links = driver.FindElementsByTag("a").Attribute("href") + links.Distinct + links.Sort + + 'writes the href values in cell A7 + links.ToExcel [Sheet2!A7] + + driver.Quit +End Sub + + +Public Sub TakeScreenShoot() + Dim driver As New ChromeDriver + + 'open the page with the URL in cell A4 + driver.Get [Sheet3!A4] + + 'Take the screenshoot in cell A7 + driver.TakeScreenshot().ToExcel [Sheet3!A7] + + driver.Quit +End Sub + diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_find.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_find.bas new file mode 100644 index 00000000..db95e0e5 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_find.bas @@ -0,0 +1,65 @@ +Attribute VB_Name = "usage_find" + +Private Assert As New Selenium.Assert + +Private Sub Find_By_LinkText() + Dim drv As New ChromeDriver + drv.Get "https://en.wikipedia.org/wiki/Main_Page" + + drv.FindElementByLinkText("Talk").Click + Assert.Matches "User talk.*", drv.title + + drv.Quit +End Sub + +Private Sub Find_By_Value() + Dim drv As New ChromeDriver + drv.Get "https://www.google.co.uk" + + Dim ele As WebElement + Set ele = drv.FindElementByXPath("//input[@value='Google Search']") + Assert.Equals "Google Search", ele.Value + + drv.Quit +End Sub + +Private Sub Find_By_Partial_Value() + Dim drv As New ChromeDriver + drv.Get "https://www.google.co.uk" + + Dim ele As WebElement + Set ele = drv.FindElementByXPath("//input[contains(@value,'Search')]") + Assert.Equals "Google Search", ele.Value + + drv.Quit +End Sub + + +Private Sub Find_By_Text() + Dim drv As New ChromeDriver + drv.Get "https://www.google.co.uk" + + If drv.FindElementsByXPath("//*[contains(text(),'Google')]").count Then + Debug.Print "Text is present" + Else + Debug.Print "Text is not present" + End If + + drv.Quit +End Sub + + +Private Sub Text_Exists() + Const JS_HAS_TEXT = "return document.body.textContent.indexOf(arguments[0]) > -1" + + Dim drv As New ChromeDriver + drv.Get "https://www.google.co.uk" + + If drv.ExecuteScript(JS_HAS_TEXT, "Google") Then + Debug.Print "Text is present" + Else + Debug.Print "Text is not present" + End If + + drv.Quit +End Sub diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_frame.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_frame.bas new file mode 100644 index 00000000..cf0cd3e8 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_frame.bas @@ -0,0 +1,24 @@ +Attribute VB_Name = "usage_frame" +Private Assert As New Selenium.Assert +Private Keys As New Selenium.Keys + + +Private Sub Handle_Frames() + Dim driver As New ChromeDriver + driver.Get "http://the-internet.herokuapp.com/nested_frames" + + 'switch to a child frame + driver.SwitchToFrame "frame-top" + Assert.Equals 3, driver.FindElementsByTag("frame").count + + 'switch to child frame of "frame-top" + driver.SwitchToFrame "frame-middle" + Assert.Equals "MIDDLE", driver.FindElementById("content").Text + + 'switch to the default content + driver.SwitchToDefaultContent + Assert.Equals 2, driver.FindElementsByTag("frame").count + + 'Stop the browser + driver.Quit +End Sub diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_get.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_get.bas new file mode 100644 index 00000000..d95a9431 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_get.bas @@ -0,0 +1,86 @@ +Attribute VB_Name = "usage_get" + +Dim Assert As New Selenium.Assert + +Private Sub GetWebPage_Url() + Dim driver As New ChromeDriver + + ' get the main page + driver.Get "https://www.google.co.uk" + Assert.Equals "https://www.google.co.uk/", driver.URL + + ' get a sub page + driver.Get "/intl/en/about/" + Assert.Equals "https://www.google.co.uk/intl/en/about/", driver.URL + + ' get another sub page + driver.baseUrl = "https://www.google.co.uk/intl/en" + driver.Get "/policies/privacy" + Assert.Equals "https://www.google.co.uk/intl/en/policies/privacy/", driver.URL + + driver.Quit +End Sub + +Private Sub GetWebPage_File() + Const html As String = _ + "" & _ + "" & _ + "
12345
" + driver.ExecuteScript "tinyMCE.activeEditor.setContent(arguments[0])", data_set + + 'insert a content using javascript + data_instert = "abcdefg
" + driver.ExecuteScript "tinyMCE.activeEditor.insertContent(arguments[0])", data_instert + + 'read and evaluate a content + data_read = driver.ExecuteScript("return tinyMCE.activeEditor.getContent()") + Assert.Equals data_instert & vbLf & data_set, data_read + + driver.Quit +End Sub + + +Private Sub Handle_TinyMCE_Simulate() + Dim driver As New ChromeDriver + driver.Get "http://the-internet.herokuapp.com/tinymce" + + Dim btBold As WebElement, btItalic As WebElement, body As WebElement + + Set btBold = driver.FindElementByCss(".mce-btn[aria-label='Bold'] button") + Set btItalic = driver.FindElementByCss(".mce-btn[aria-label='Italic'] button") + + 'clear body + driver.SwitchToFrame 0 + Set body = driver.FindElementByTag("body") + body.Clear + + 'set bold and italic + driver.SwitchToDefaultContent + btBold.Click + btItalic.Click + + 'set and eval text + driver.SwitchToFrame 0 + body.SendKeys "abcde12345" + Assert.Equals "abcde12345", body.Text + + driver.Quit +End Sub + + + + + + diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_javascript.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_javascript.bas new file mode 100644 index 00000000..cff680b9 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_javascript.bas @@ -0,0 +1,70 @@ +Attribute VB_Name = "usage_javascript" + +'' +' Executes a piece of Javascript on the page. +'' +Private Sub Execute_Script() + Dim driver As New ChromeDriver + driver.Get "https://en.wikipedia.org/wiki/Main_Page" + + Dim title + title = driver.ExecuteScript("return document.title;") + Debug.Assert "Wikipedia, the free encyclopedia" = title + + driver.Quit +End Sub + +'' +' Executes a piece of Javascript on a web element. +' The web element is the context itself which is "this". +'' +Private Sub Execute_Script_On_Element() + Dim driver As New ChromeDriver + driver.Get "https://en.wikipedia.org/wiki/Main_Page" + + Dim name + name = driver.FindElementById("searchInput") _ + .ExecuteScript("return this.name;") + + Debug.Assert "search" = name + + driver.Quit +End Sub + +'' +' Executes a piece of Javascript on a collection of web elements. +' The web element is the context itself which is "this". +'' +Private Sub Execute_Script_On_Elements() + Dim driver As New ChromeDriver + driver.Get "https://en.wikipedia.org/wiki/Main_Page" + + Dim links + Set links = driver.FindElementsByTag("a") _ + .ExecuteScript("return this.href;") + + driver.Quit +End Sub + +'' +' Executes an asynchronous piece of Javascript. +' The script returns once "callback" is called. +'' +Private Sub Execute_Script_Async() + Dim driver As New ChromeDriver + driver.Get "https://en.wikipedia.org/wiki/Main_Page" + + Dim response + response = driver.ExecuteAsyncScript( _ + "var r = new XMLHttpRequest();" & _ + "r.onreadystatechange = function(){" & _ + " if(r.readyState == XMLHttpRequest.DONE)" & _ + " callback(this.responseText);" & _ + "};" & _ + "r.open('GET', 'wiki/Euro');" & _ + "r.send();") + + Debug.Print response + driver.Quit +End Sub + diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_list.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_list.bas new file mode 100644 index 00000000..465d748f --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_list.bas @@ -0,0 +1,30 @@ +Attribute VB_Name = "usage_list" +Private Assert As New Selenium.Assert +Private Keys As New Selenium.Keys + + +Private Sub Handle_Dropdown_List() + Dim driver As New ChromeDriver + driver.Get "http://the-internet.herokuapp.com/dropdown" + + Dim ele As SelectElement + Set ele = driver.FindElementById("dropdown").AsSelect + ele.SelectByText "Option 2" + Assert.Equals "Option 2", ele.SelectedOption.Text + + driver.Quit +End Sub + + + +Private Sub Handle_Multi_Select() + Dim driver As New ChromeDriver + driver.Get "http://odyniec.net/articles/multiple-select-fields" + + Dim ele As WebElement + For Each ele In driver.FindElementsByXPath("//select[@name='ingredients[]']/option") + ele.Click Keys.Control + Next + + driver.Quit +End Sub diff --git a/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_other.bas b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_other.bas new file mode 100644 index 00000000..8e1f8a65 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/_ref/Excel/Examples/usage_other.bas @@ -0,0 +1,104 @@ +Attribute VB_Name = "usage_other" + +Private Const JS_GET_TIMINGS As String = _ + "var t=performance.timing; return [ " & _ + " t.responseEnd - t.navigationStart, " & _ + " t.loadEventEnd - t.responseEnd ]; " + +Private Const JS_BUILD_CSS = _ + "var e=this,p=[],h=function(a,s){if(!a||!s)return 0;for(var i=0,l=a.length;ishow user agent, should show undefined
+ + + + diff --git a/armandarmand/task1/task1-ticket1/excel_ws/_old/main_old.xlsm b/armandarmand/task1/task1-ticket1/excel_ws/_old/main_old.xlsm new file mode 100644 index 00000000..b1f31ad1 Binary files /dev/null and b/armandarmand/task1/task1-ticket1/excel_ws/_old/main_old.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/excel_ws/test/ThisWorkbook.cls b/armandarmand/task1/task1-ticket1/excel_ws/test/ThisWorkbook.cls new file mode 100644 index 00000000..6b09ce9b --- /dev/null +++ b/armandarmand/task1/task1-ticket1/excel_ws/test/ThisWorkbook.cls @@ -0,0 +1,5 @@ +Option Explicit + +Sub helloworld() + Worksheets ("Sheet1") +End Sub diff --git a/armandarmand/task1/task1-ticket1/excel_ws/test/edit.bat b/armandarmand/task1/task1-ticket1/excel_ws/test/edit.bat new file mode 100644 index 00000000..e6bdb284 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/excel_ws/test/edit.bat @@ -0,0 +1,3 @@ +@REM rmdir *.bas + +xlwings vba edit --file .\main.xlsm diff --git a/armandarmand/task1/task1-ticket1/excel_ws/test/main.xlsm b/armandarmand/task1/task1-ticket1/excel_ws/test/main.xlsm new file mode 100644 index 00000000..7862b125 Binary files /dev/null and b/armandarmand/task1/task1-ticket1/excel_ws/test/main.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/gitUpdate.bat b/armandarmand/task1/task1-ticket1/gitUpdate.bat new file mode 100644 index 00000000..7ce27688 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/gitUpdate.bat @@ -0,0 +1,4 @@ +git pull +git add . +git commit -m"update armandarmand task1-tciket1," +start git push diff --git a/armandarmand/task1/task1-ticket1/helloworld/_tests/daily stock template-draft-selenium.xlsm b/armandarmand/task1/task1-ticket1/helloworld/_tests/daily stock template-draft-selenium.xlsm new file mode 100644 index 00000000..53c843c4 Binary files /dev/null and b/armandarmand/task1/task1-ticket1/helloworld/_tests/daily stock template-draft-selenium.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/helloworld/_tests/daily stock template-original.xlsx b/armandarmand/task1/task1-ticket1/helloworld/_tests/daily stock template-original.xlsx new file mode 100644 index 00000000..0328f731 Binary files /dev/null and b/armandarmand/task1/task1-ticket1/helloworld/_tests/daily stock template-original.xlsx differ diff --git a/armandarmand/task1/task1-ticket1/helloworld/_tests/daily stock template.xlsm b/armandarmand/task1/task1-ticket1/helloworld/_tests/daily stock template.xlsm new file mode 100644 index 00000000..b8449795 Binary files /dev/null and b/armandarmand/task1/task1-ticket1/helloworld/_tests/daily stock template.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/CheckLastRow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/CheckLastRow.bas new file mode 100644 index 00000000..4a18e92a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/CheckLastRow.bas @@ -0,0 +1,8 @@ +Attribute VB_Name = "CheckLastRow" +Option Explicit + +Function run(row as integer) + Dim last_check_row as integer + Dim last_row as boolean + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Config.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Config.bas new file mode 100644 index 00000000..f49bdda3 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Config.bas @@ -0,0 +1,97 @@ +Option Explicit + +Global TARGET_SHEET as string +Global ROW_START as Integer + +Global ChromiumBinaryPath As String + +Global COL_STOCK_CODE As String +Global COL_STOCK_NAME As String +Global COL_STOCK_PRICE As String +Global COL_10_DAY_MOVING_AVERAGE As String +Global COL_20_DAY_MOVING_AVERAGE As String +Global COL_50_DAY_MOVING_AVERAGE As String +Global COL_100_DAY_MOVING_AVERAGE As String +Global COL_250_DAY_MOVING_AVERAGE As String +Global COL_P_E_RATIO_EXPECTED As String +Global COL_EARNINGS_PER_SHARE As String +Global COL_YIELD As String +Global COL_FUND_FLOW As String +Global COL_SHORT_SELLING_AMOUNT_RATIO_ As String +Global COL_RSI_10 As String +Global COL_RSI_14 As String +Global COL_RSI_20 As String +Global COL_MACD_8_17_DAYS As String +Global COL_MACD_12_25_DAYS As String + +Global IDX_STOCK_CODE As Integer +Global IDX_STOCK_NAME As Integer +Global IDX_STOCK_PRICE As Integer +Global IDX_10_DAY_MOVING_AVERAGE As Integer +Global IDX_20_DAY_MOVING_AVERAGE As Integer +Global IDX_50_DAY_MOVING_AVERAGE As Integer +Global IDX_100_DAY_MOVING_AVERAGE As Integer +Global IDX_250_DAY_MOVING_AVERAGE As Integer +Global IDX_P_E_RATIO_EXPECTED As Integer +Global IDX_EARNINGS_PER_SHARE As Integer +Global IDX_YIELD As Integer +Global IDX_FUND_FLOW As Integer +Global IDX_SHORT_SELLING_AMOUNT_RATIO_ As Integer +Global IDX_RSI_10 As Integer +Global IDX_RSI_14 As Integer +Global IDX_RSI_20 As Integer +Global IDX_MACD_8_17_DAYS As Integer +Global IDX_MACD_12_25_DAYS As Integer + + +Global COL_RESULT As String + + +Sub init() + ChromiumBinaryPath = "C:\Users\logic\AppData\Local\Chromium\Application\chrome.exe" + + TARGET_SHEET = "Sheet1" + + ROW_START = 11 + + COL_STOCK_CODE = "A" + COL_STOCK_NAME = "B" + COL_STOCK_PRICE = "C" + COL_10_DAY_MOVING_AVERAGE = "D" + COL_20_DAY_MOVING_AVERAGE = "E" + COL_50_DAY_MOVING_AVERAGE = "F" + COL_100_DAY_MOVING_AVERAGE = "G" + COL_250_DAY_MOVING_AVERAGE = "H" + COL_P_E_RATIO_EXPECTED = "L" + COL_EARNINGS_PER_SHARE = "M" + COL_YIELD = "N" + COL_FUND_FLOW = "O" + COL_SHORT_SELLING_AMOUNT_RATIO_ = "P" + COL_RSI_10 = "Q" + COL_RSI_14 = "R" + COL_RSI_20 = "S" + COL_MACD_8_17_DAYS = "V" + COL_MACD_12_25_DAYS = "W" + + COL_RESULT = "AE" + + IDX_STOCK_CODE = 0 + IDX_STOCK_PRICE = 1 + IDX_STOCK_NAME = 2 + IDX_10_DAY_MOVING_AVERAGE = 4 + IDX_20_DAY_MOVING_AVERAGE = 5 + IDX_50_DAY_MOVING_AVERAGE = 6 + IDX_100_DAY_MOVING_AVERAGE = 7 + IDX_250_DAY_MOVING_AVERAGE = 8 + IDX_P_E_RATIO_EXPECTED = 9 + IDX_EARNINGS_PER_SHARE = 10 + IDX_YIELD = 11 + IDX_FUND_FLOW = 12 + IDX_SHORT_SELLING_AMOUNT_RATIO_ = 13 + IDX_RSI_10 = 14 + IDX_RSI_14 = 15 + IDX_RSI_20 = 16 + IDX_MACD_8_17_DAYS = 17 + IDX_MACD_12_25_DAYS = 18 + +End Sub diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/FetchAaStock.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/FetchAaStock.bas new file mode 100644 index 00000000..33c19ef2 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/FetchAaStock.bas @@ -0,0 +1,96 @@ +Attribute VB_Name = "FetchAaStock" + +Dim driver As New ChromeDriver + +Function run(stock_num as integer) + ' On Error GoTo eh + + Dim fetch_result(0 To 22) As String + + driver.SetBinary ChromiumBinaryPath + driver.AddArgument "--disable-blink-features=AutomationControlled" + + driver.Start + + ' ' driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})") + ' ' driver.ExecuteScript "alert('helloworld')" + driver.ExecuteScript "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})" + + + ' ' driver.Get "http://localhost:8080/navigator_webdriver_test.html" + ' ' https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html + ' driver.Get "https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html" + + ' driver.ExecuteScript "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})" + + driver.Get "http://www.aastocks.com" + ' driver.ExecuteScript "console.log('hello excel')" + driver.ExecuteScript "document.querySelector('#sb-txtSymbol-aa').value = '"& stock_num &"'" + driver.ExecuteScript "document.querySelector('#sb-btnSubmit').click()" + driver.ExecuteScript "document.querySelectorAll('span.float_l')[6].click()" + + Debug.Print driver.ExecuteScript("{ return 'helloworld from chrome' }") + + ' stock_Name # Name + fetch_result(IDX_STOCK_NAME)= driver.ExecuteScript("{ return document.querySelector('#SQ_Name').textContent.trim() }") + + ' stock_Price # Price + fetch_result(IDX_STOCK_PRICE)= driver.ExecuteScript("{ return document.querySelector('#labelLast').textContent.trim() }") + + ' 10_day_Moving_Average # 10???? + fetch_result(IDX_10_DAY_MOVING_AVERAGE)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[1].querySelectorAll('td')[1].textContent.trim() }") + + ' 20_day_Moving_Average # 20???? + fetch_result(IDX_20_DAY_MOVING_AVERAGE)= "20_day_Moving_Average missing" + + ' 50_day_Moving_Average # 50???? + fetch_result(IDX_50_DAY_MOVING_AVERAGE)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[2].querySelectorAll('td')[1].textContent.trim() }") + + ' 100_day_Moving_Average # 100???? + fetch_result(IDX_100_DAY_MOVING_AVERAGE)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[3].querySelectorAll('td')[1].textContent.trim() }") + + ' 250_day_Moving_Average # 250???? + fetch_result(IDX_250_DAY_MOVING_AVERAGE)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[4].querySelectorAll('td')[1].textContent.trim() }") + + ' P_E_Ratio_Expected # ???/?? + fetch_result(IDX_P_E_RATIO_EXPECTED)= driver.ExecuteScript("{ return document.querySelectorAll('#tbPERatio div')[5].textContent.trim() }") + + ' Earnings_per_Share # ?????? + fetch_result(IDX_EARNINGS_PER_SHARE)= "earnings_per_share is missing" + + ' Yield # ??? + fetch_result(IDX_YIELD)= driver.ExecuteScript("{ return document.querySelectorAll('.quote-box div')[19].textContent.trim() }") + + ' Fund_Flow # ???? + fetch_result(IDX_FUND_FLOW)= driver.ExecuteScript("{ return document.querySelectorAll('.quote-box div')[29].textContent.trim() }") + + ' Short_Selling_Amount_Ratio_% # ???_??(%) + fetch_result(IDX_SHORT_SELLING_AMOUNT_RATIO_)= driver.ExecuteScript("{ return document.querySelectorAll('.quote-box div')[4].textContent.trim() }") + + ' RSI_10 # RSI 10 + fetch_result(IDX_RSI_10)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[0].querySelector('.txt_r').textContent.trim() }") + + ' RSI_14 # RSI 14 + fetch_result(IDX_RSI_14)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[0].querySelector('.txt_r').textContent.trim() }") + + ' RSI_20 # RSI 20 + fetch_result(IDX_RSI_20)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[1].querySelector('.txt_r').textContent.trim() }") + + ' MACD_8_17_days # MACD(8_17 ?) + fetch_result(IDX_MACD_8_17_DAYS)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[2].querySelector('.txt_r').textContent.trim() }") + + ' MACD_12_25_days # MACD(12/25 ?) + fetch_result(IDX_MACD_12_25_DAYS)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[3].querySelector('.txt_r').textContent.trim() }") + + ' Application.Wait Now + TimeValue("00:30:01") + driver.Quit + +Done: + ' Debug.Print "hello done" + run = fetch_result + Exit Function + +eh: + Debug.Print "hello error" + +End Function \ No newline at end of file diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/GetLastCheckRow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/GetLastCheckRow.bas new file mode 100644 index 00000000..7d08bace --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/GetLastCheckRow.bas @@ -0,0 +1,5 @@ +Attribute VB_Name = "GetLastCheckRow" +Function run(first_row As Integer) + getLastCheckRow = first_row + 10 +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Helloworld.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Helloworld.bas new file mode 100644 index 00000000..bf3c26da --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Helloworld.bas @@ -0,0 +1,74 @@ +Option Explicit + + +Dim rowc, cc, columnC As Integer + +Sub helloworld() + ' On Error GoTo eh + + Config.init + Dim temp as Variant + + ' Debug.print ReadStockCode.run(11) + temp = FetchAaStock.run(268) + + ' Debug.print temp(IDX_STOCK_PRICE) + Debug.print temp(IDX_STOCK_NAME) + + Write_10DayMovingAverage.run 11, CStr(temp(IDX_10_DAY_MOVING_AVERAGE)) + Write_50DayMovingAverage.run 11, CStr(temp(IDX_50_DAY_MOVING_AVERAGE)) + Write_100DayMovingAverage.run 11, CStr(temp(IDX_100_DAY_MOVING_AVERAGE)) + Write_250DayMovingAverage.run 11, CStr(temp(IDX_250_DAY_MOVING_AVERAGE)) + + WriteRsi_10.run 11, CStr(temp(IDX_10_DAY_MOVING_AVERAGE)) + WriteRsi_14.run 11, CStr(temp(IDX_50_DAY_MOVING_AVERAGE)) + WriteRsi_20.run 11, CStr(temp(IDX_50_DAY_MOVING_AVERAGE)) + + WriteMACD_8_17Days.run 11, CStr(temp(IDX_MACD_8_17_DAYS)) + WriteMACD_12_25Days.run 11, CStr(temp(IDX_MACD_12_25_DAYS)) + + WriteEarningsPerShare.run 11, CStr(temp(IDX_EARNINGS_PER_SHARE)) + WriteFundFlow.run 11, CStr(temp(IDX_FUND_FLOW)) + WritePERatioExpected.run 11, CStr(temp(IDX_P_E_RATIO_EXPECTED)) + WriteShortSellingAmountRatio.run 11, CStr(temp(IDX_SHORT_SELLING_AMOUNT_RATIO_)) + ' WriteStockCode.run 11, CStr(temp(IDX_STOCK_CODE)) + WriteStockName.run 11, CStr(temp(IDX_STOCK_NAME)) + WriteStockPrice.run 11, CStr(temp(IDX_STOCK_PRICE)) + WriteYield.run 11, CStr(temp(IDX_YIELD)) + + + ' driver.SetBinary ChromiumBinaryPath + + ' driver.Start + ' driver.AddArgument "--disable-blink-features=AutomationControlled" + + + ' ' driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})") + ' ' driver.ExecuteScript "alert('helloworld')" + ' ' driver.ExecuteScript "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})" + + + ' ' driver.Get "http://localhost:8080/navigator_webdriver_test.html" + ' ' https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html + ' ' driver.Get "https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html" + + ' driver.ExecuteScript "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})" + + + ' driver.Get "http://www.aastocks.com" + ' driver.ExecuteScript "console.log('hello excel')" + ' driver.ExecuteScript "document.querySelector('#sb-txtSymbol-aa').value = '939'" + ' driver.ExecuteScript "document.querySelector('#sb-btnSubmit').click()" + ' Debug.Print driver.ExecuteScript("return 'helloworld'") + + Application.Wait Now + TimeValue("00:00:01") + +Done: + Debug.Print "hello done" + + Exit Sub + +eh: + Debug.Print "hello error" + +End Sub diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadEarningsPerShare.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadEarningsPerShare.bas new file mode 100644 index 00000000..51f10851 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadEarningsPerShare.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadEarningsPerShare" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadFundFlow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadFundFlow.bas new file mode 100644 index 00000000..a4723791 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadFundFlow.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadFundFlow" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadMACD_12_25Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadMACD_12_25Days.bas new file mode 100644 index 00000000..6e3983d9 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadMACD_12_25Days.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadMACD_12_25Days" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadMacd_8_17Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadMacd_8_17Days.bas new file mode 100644 index 00000000..948dadc7 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadMacd_8_17Days.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadMacd_8_17Days" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadPERatioExpected.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadPERatioExpected.bas new file mode 100644 index 00000000..7d2e7fa9 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadPERatioExpected.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadPERatioExpected" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadRsi_10.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadRsi_10.bas new file mode 100644 index 00000000..1b92882e --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadRsi_10.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadRsi_10" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadRsi_14.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadRsi_14.bas new file mode 100644 index 00000000..24a846bf --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadRsi_14.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadRsi_14" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadRsi_20.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadRsi_20.bas new file mode 100644 index 00000000..c9cc657a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadRsi_20.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadRsi_20" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadShortSellingAmountRatio.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadShortSellingAmountRatio.bas new file mode 100644 index 00000000..abf5f31f --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadShortSellingAmountRatio.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadShortSellingAmountRatio" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadStockCode.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadStockCode.bas new file mode 100644 index 00000000..2eedaa46 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadStockCode.bas @@ -0,0 +1,7 @@ +Attribute VB_Name = "ReadStockCode" +Option Explicit + +Function run(row as integer) + run = Worksheets("Sheet1").Range("A" & CStr(row)).Value + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadStockName.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadStockName.bas new file mode 100644 index 00000000..0080391d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadStockName.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadStockName" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadStockPrice.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadStockPrice.bas new file mode 100644 index 00000000..0be2afb4 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadStockPrice.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadStockPrice" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadYield.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadYield.bas new file mode 100644 index 00000000..93a1f76f --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ReadYield.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadYield" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Read_100DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Read_100DayMovingAverage.bas new file mode 100644 index 00000000..1b8e03f4 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Read_100DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_100DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Read_10DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Read_10DayMovingAverage.bas new file mode 100644 index 00000000..6473b178 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Read_10DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_10DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Read_20DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Read_20DayMovingAverage.bas new file mode 100644 index 00000000..cc083f34 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Read_20DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_20DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Read_250DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Read_250DayMovingAverage.bas new file mode 100644 index 00000000..6dfeb91c --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Read_250DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_250DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ThisWorkbook.cls b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ThisWorkbook.cls new file mode 100644 index 00000000..f1ba4358 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/ThisWorkbook.cls @@ -0,0 +1,5 @@ +Option Explicit + +Sub Helloworld() + Worksheets ("Sheet1") +End Sub diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteEarningsPerShare.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteEarningsPerShare.bas new file mode 100644 index 00000000..7b034b10 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteEarningsPerShare.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteEarningsPerShare" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_EARNINGS_PER_SHARE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteEarningsPerShare" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteFundFlow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteFundFlow.bas new file mode 100644 index 00000000..22869c15 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteFundFlow.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteFundFlow" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_FUND_FLOW & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteFundFlow" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteMACD_12_25Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteMACD_12_25Days.bas new file mode 100644 index 00000000..422f81eb --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteMACD_12_25Days.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteMACD_12_25Days" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_MACD_12_25_DAYS & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteMACD_12_25Days" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteMACD_8_17Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteMACD_8_17Days.bas new file mode 100644 index 00000000..876cb7ab --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteMACD_8_17Days.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteMACD_8_17Days" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_MACD_8_17_DAYS & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteMACD_8_17Days" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WritePERatioExpected.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WritePERatioExpected.bas new file mode 100644 index 00000000..a061a249 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WritePERatioExpected.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WritePERatioExpected" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_P_E_RATIO_EXPECTED & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WritePERatioExpected" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteRsi_10.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteRsi_10.bas new file mode 100644 index 00000000..7ac4223f --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteRsi_10.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteRsi_10" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI_10 & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteRsi_10" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteRsi_14.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteRsi_14.bas new file mode 100644 index 00000000..ca7cfc8f --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteRsi_14.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteRsi_14" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI_14 & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteRsi_14" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteRsi_20.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteRsi_20.bas new file mode 100644 index 00000000..9535b4bd --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteRsi_20.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteRsi_20" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI_20 & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteRsi_20" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteShortSellingAmountRatio.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteShortSellingAmountRatio.bas new file mode 100644 index 00000000..d2361913 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteShortSellingAmountRatio.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteShortSellingAmountRatio" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_SHORT_SELLING_AMOUNT_RATIO_ & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteShortSellingAmountRatio" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteStockCode.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteStockCode.bas new file mode 100644 index 00000000..bf83fe74 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteStockCode.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteStockCode" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_STOCK_CODE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteStockCode" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteStockName.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteStockName.bas new file mode 100644 index 00000000..fd78ddc0 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteStockName.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteStockName" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_STOCK_NAME & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteStockName" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteStockPrice.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteStockPrice.bas new file mode 100644 index 00000000..d8653e4d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteStockPrice.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteStockPrice" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_STOCK_PRICE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteStockPrice" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteYield.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteYield.bas new file mode 100644 index 00000000..39524039 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/WriteYield.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteYield" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_YIELD & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteYield" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_100DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_100DayMovingAverage.bas new file mode 100644 index 00000000..9a1a0afc --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_100DayMovingAverage.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "Write_100DayMovingAverage" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_100_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "Write_100DayMovingAverage" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_10DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_10DayMovingAverage.bas new file mode 100644 index 00000000..0a3fb29d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_10DayMovingAverage.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "Write_10DayMovingAverage" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_10_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "Write_10DayMovingAverage" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_20DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_20DayMovingAverage.bas new file mode 100644 index 00000000..3473032a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_20DayMovingAverage.bas @@ -0,0 +1,6 @@ +Attribute VB_Name = "Write_20DayMovingAverage" +Option Explicit + +Function run() + Debug.Print "Helloworld Write_20DayMovingAverage" +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_250DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_250DayMovingAverage.bas new file mode 100644 index 00000000..ef1370f4 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_250DayMovingAverage.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "Write_250DayMovingAverage" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_250_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "Write_250DayMovingAverage" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_50DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_50DayMovingAverage.bas new file mode 100644 index 00000000..def73f37 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/Write_50DayMovingAverage.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "Write_50DayMovingAverage" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_50_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "Write_50DayMovingAverage" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/dev.bat b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/dev.bat new file mode 100644 index 00000000..3c8e31ec --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/dev.bat @@ -0,0 +1,5 @@ +@REM start excel by yourself + +@REM ./test.xlsm + +xlwings vba edit diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/package.json b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/package.json new file mode 100644 index 00000000..720880d6 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/package.json @@ -0,0 +1,13 @@ +{ + "name": "hello-error", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "gitUpdate":"git add . && git commit -m\"update,\"" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/test.xlsm b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/test.xlsm new file mode 100644 index 00000000..bb9d8522 Binary files /dev/null and b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock-draft1/test.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/CheckLastRow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/CheckLastRow.bas new file mode 100644 index 00000000..4a18e92a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/CheckLastRow.bas @@ -0,0 +1,8 @@ +Attribute VB_Name = "CheckLastRow" +Option Explicit + +Function run(row as integer) + Dim last_check_row as integer + Dim last_row as boolean + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Config.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Config.bas new file mode 100644 index 00000000..f49bdda3 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Config.bas @@ -0,0 +1,97 @@ +Option Explicit + +Global TARGET_SHEET as string +Global ROW_START as Integer + +Global ChromiumBinaryPath As String + +Global COL_STOCK_CODE As String +Global COL_STOCK_NAME As String +Global COL_STOCK_PRICE As String +Global COL_10_DAY_MOVING_AVERAGE As String +Global COL_20_DAY_MOVING_AVERAGE As String +Global COL_50_DAY_MOVING_AVERAGE As String +Global COL_100_DAY_MOVING_AVERAGE As String +Global COL_250_DAY_MOVING_AVERAGE As String +Global COL_P_E_RATIO_EXPECTED As String +Global COL_EARNINGS_PER_SHARE As String +Global COL_YIELD As String +Global COL_FUND_FLOW As String +Global COL_SHORT_SELLING_AMOUNT_RATIO_ As String +Global COL_RSI_10 As String +Global COL_RSI_14 As String +Global COL_RSI_20 As String +Global COL_MACD_8_17_DAYS As String +Global COL_MACD_12_25_DAYS As String + +Global IDX_STOCK_CODE As Integer +Global IDX_STOCK_NAME As Integer +Global IDX_STOCK_PRICE As Integer +Global IDX_10_DAY_MOVING_AVERAGE As Integer +Global IDX_20_DAY_MOVING_AVERAGE As Integer +Global IDX_50_DAY_MOVING_AVERAGE As Integer +Global IDX_100_DAY_MOVING_AVERAGE As Integer +Global IDX_250_DAY_MOVING_AVERAGE As Integer +Global IDX_P_E_RATIO_EXPECTED As Integer +Global IDX_EARNINGS_PER_SHARE As Integer +Global IDX_YIELD As Integer +Global IDX_FUND_FLOW As Integer +Global IDX_SHORT_SELLING_AMOUNT_RATIO_ As Integer +Global IDX_RSI_10 As Integer +Global IDX_RSI_14 As Integer +Global IDX_RSI_20 As Integer +Global IDX_MACD_8_17_DAYS As Integer +Global IDX_MACD_12_25_DAYS As Integer + + +Global COL_RESULT As String + + +Sub init() + ChromiumBinaryPath = "C:\Users\logic\AppData\Local\Chromium\Application\chrome.exe" + + TARGET_SHEET = "Sheet1" + + ROW_START = 11 + + COL_STOCK_CODE = "A" + COL_STOCK_NAME = "B" + COL_STOCK_PRICE = "C" + COL_10_DAY_MOVING_AVERAGE = "D" + COL_20_DAY_MOVING_AVERAGE = "E" + COL_50_DAY_MOVING_AVERAGE = "F" + COL_100_DAY_MOVING_AVERAGE = "G" + COL_250_DAY_MOVING_AVERAGE = "H" + COL_P_E_RATIO_EXPECTED = "L" + COL_EARNINGS_PER_SHARE = "M" + COL_YIELD = "N" + COL_FUND_FLOW = "O" + COL_SHORT_SELLING_AMOUNT_RATIO_ = "P" + COL_RSI_10 = "Q" + COL_RSI_14 = "R" + COL_RSI_20 = "S" + COL_MACD_8_17_DAYS = "V" + COL_MACD_12_25_DAYS = "W" + + COL_RESULT = "AE" + + IDX_STOCK_CODE = 0 + IDX_STOCK_PRICE = 1 + IDX_STOCK_NAME = 2 + IDX_10_DAY_MOVING_AVERAGE = 4 + IDX_20_DAY_MOVING_AVERAGE = 5 + IDX_50_DAY_MOVING_AVERAGE = 6 + IDX_100_DAY_MOVING_AVERAGE = 7 + IDX_250_DAY_MOVING_AVERAGE = 8 + IDX_P_E_RATIO_EXPECTED = 9 + IDX_EARNINGS_PER_SHARE = 10 + IDX_YIELD = 11 + IDX_FUND_FLOW = 12 + IDX_SHORT_SELLING_AMOUNT_RATIO_ = 13 + IDX_RSI_10 = 14 + IDX_RSI_14 = 15 + IDX_RSI_20 = 16 + IDX_MACD_8_17_DAYS = 17 + IDX_MACD_12_25_DAYS = 18 + +End Sub diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/FetchAaStock.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/FetchAaStock.bas new file mode 100644 index 00000000..48d74f59 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/FetchAaStock.bas @@ -0,0 +1,98 @@ +Attribute VB_Name = "FetchAaStock" + + + +Function run(stock_num as integer) + ' On Error GoTo eh + + Dim fetch_result(0 To 22) As String + + Dim driver As New ChromeDriver + + driver.SetBinary ChromiumBinaryPath + driver.AddArgument "--disable-blink-features=AutomationControlled" + + driver.Start + + ' ' driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})") + ' ' driver.ExecuteScript "alert('helloworld')" + driver.ExecuteScript "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})" + + + ' ' driver.Get "http://localhost:8080/navigator_webdriver_test.html" + ' ' https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html + ' driver.Get "https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html" + + ' driver.ExecuteScript "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})" + + driver.Get "http://www.aastocks.com" + ' driver.ExecuteScript "console.log('hello excel')" + driver.ExecuteScript "document.querySelector('#sb-txtSymbol-aa').value = '"& stock_num &"'" + driver.ExecuteScript "document.querySelector('#sb-btnSubmit').click()" + driver.ExecuteScript "document.querySelectorAll('span.float_l')[6].click()" + + Debug.Print driver.ExecuteScript("{ return 'helloworld from chrome' }") + + ' stock_Name # Name + fetch_result(IDX_STOCK_NAME)= driver.ExecuteScript("{ return document.querySelector('#SQ_Name').textContent.trim() }") + + ' stock_Price # Price + fetch_result(IDX_STOCK_PRICE)= driver.ExecuteScript("{ return document.querySelector('#labelLast').textContent.trim() }") + + ' 10_day_Moving_Average # 10???? + fetch_result(IDX_10_DAY_MOVING_AVERAGE)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[1].querySelectorAll('td')[1].textContent.trim() }") + + ' 20_day_Moving_Average # 20???? + fetch_result(IDX_20_DAY_MOVING_AVERAGE)= "20_day_Moving_Average missing" + + ' 50_day_Moving_Average # 50???? + fetch_result(IDX_50_DAY_MOVING_AVERAGE)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[2].querySelectorAll('td')[1].textContent.trim() }") + + ' 100_day_Moving_Average # 100???? + fetch_result(IDX_100_DAY_MOVING_AVERAGE)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[3].querySelectorAll('td')[1].textContent.trim() }") + + ' 250_day_Moving_Average # 250???? + fetch_result(IDX_250_DAY_MOVING_AVERAGE)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[4].querySelectorAll('td')[1].textContent.trim() }") + + ' P_E_Ratio_Expected # ???/?? + fetch_result(IDX_P_E_RATIO_EXPECTED)= driver.ExecuteScript("{ return document.querySelectorAll('#tbPERatio div')[5].textContent.trim() }") + + ' Earnings_per_Share # ?????? + fetch_result(IDX_EARNINGS_PER_SHARE)= "earnings_per_share is missing" + + ' Yield # ??? + fetch_result(IDX_YIELD)= driver.ExecuteScript("{ return document.querySelectorAll('.quote-box div')[19].textContent.trim() }") + + ' Fund_Flow # ???? + fetch_result(IDX_FUND_FLOW)= driver.ExecuteScript("{ return document.querySelectorAll('.quote-box div')[29].textContent.trim() }") + + ' Short_Selling_Amount_Ratio_% # ???_??(%) + fetch_result(IDX_SHORT_SELLING_AMOUNT_RATIO_)= driver.ExecuteScript("{ return document.querySelectorAll('.quote-box div')[4].textContent.trim() }") + + ' RSI_10 # RSI 10 + fetch_result(IDX_RSI_10)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[0].querySelector('.txt_r').textContent.trim() }") + + ' RSI_14 # RSI 14 + fetch_result(IDX_RSI_14)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[0].querySelector('.txt_r').textContent.trim() }") + + ' RSI_20 # RSI 20 + fetch_result(IDX_RSI_20)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[1].querySelector('.txt_r').textContent.trim() }") + + ' MACD_8_17_days # MACD(8_17 ?) + fetch_result(IDX_MACD_8_17_DAYS)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[2].querySelector('.txt_r').textContent.trim() }") + + ' MACD_12_25_days # MACD(12/25 ?) + fetch_result(IDX_MACD_12_25_DAYS)= driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[3].querySelector('.txt_r').textContent.trim() }") + + ' Application.Wait Now + TimeValue("00:30:01") + driver.Quit + + run = fetch_result +Done: + ' Debug.Print "hello done" + Exit Function + +eh: + Debug.Print "hello error" + +End Function \ No newline at end of file diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/GetLastCheckRow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/GetLastCheckRow.bas new file mode 100644 index 00000000..7d08bace --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/GetLastCheckRow.bas @@ -0,0 +1,5 @@ +Attribute VB_Name = "GetLastCheckRow" +Function run(first_row As Integer) + getLastCheckRow = first_row + 10 +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/GetLastRow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/GetLastRow.bas new file mode 100644 index 00000000..f0ff4253 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/GetLastRow.bas @@ -0,0 +1,68 @@ +Option Explicit + +Function run(start_row As Integer) + On Error GoTo eh + Dim last_row As Boolean + + Dim last_check_row as integer + last_check_row = 9999 + Dim scan_row as integer + scan_row = start_row + + + Dim next_row_1 As Integer + Dim next_row_2 As Integer + Dim next_row_3 As Integer + Dim next_row_4 As Integer + Dim next_row_5 As Integer + + For i = start_row To last_check_row + scan_row = i + last_row = True + + next_row_1 = i + 1 + next_row_2 = i + 2 + next_row_3 = i + 3 + next_row_4 = i + 4 + next_row_5 = i + 5 + + cell_value_1 = ReadCellValue.run("A" & CStr(next_row_1)) + cell_value_2 = ReadCellValue.run("A" & CStr(next_row_2)) + cell_value_3 = ReadCellValue.run("A" & CStr(next_row_3)) + cell_value_4 = ReadCellValue.run("A" & CStr(next_row_4)) + cell_value_5 = ReadCellValue.run("A" & CStr(next_row_5)) + + If (cell_value_1 <> "") Then + last_row = False + ElseIf (cell_value_2 <> "") Then + last_row = False + ElseIf (cell_value_3 <> "") Then + last_row = False + ElseIf (cell_value_4 <> "") Then + last_row = False + ElseIf (cell_value_5 <> "") Then + last_row = False + Else + Debug.Print "done ?" + End If + + + if (last_row = true) then + Debug.Print "last row found" + + exit for + end if + + next i + + run = scan_row +Done: + + Exit Function + +eh: + Debug.Print "WriteStatus" + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Helloworld.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Helloworld.bas new file mode 100644 index 00000000..5419d5c1 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Helloworld.bas @@ -0,0 +1,68 @@ +Option Explicit + + +Dim rowc, cc, columnC As Integer +Dim last_row as integer +Dim i as integer +Dim stock_code as integer + +Sub helloworld() + ' On Error GoTo eh + + WriteStatus.run "init config" + Config.init + WriteStatus.run "init config done" + + ' find last row + last_row = GetLastRow.run(11) + 'last_row = 23 + Debug.print last_row + + for i = ROW_START to last_row + stock_code = CInt(ReadStockCode.run(i)) + + if (stock_code > -1) then + temp = FetchAaStock.run(stock_code) + WriteStatus.run "updateing stock code " & CStr(stock_code) & "..." + + WriteStockName.run i, CStr(temp(IDX_STOCK_NAME)) + Write_10DayMovingAverage.run i, CStr(temp(IDX_10_DAY_MOVING_AVERAGE)) + Write_50DayMovingAverage.run i, CStr(temp(IDX_50_DAY_MOVING_AVERAGE)) + Write_100DayMovingAverage.run i, CStr(temp(IDX_100_DAY_MOVING_AVERAGE)) + Write_250DayMovingAverage.run i, CStr(temp(IDX_250_DAY_MOVING_AVERAGE)) + + WriteRsi_10.run i, CStr(temp(IDX_10_DAY_MOVING_AVERAGE)) + WriteRsi_14.run i, CStr(temp(IDX_50_DAY_MOVING_AVERAGE)) + WriteRsi_20.run i, CStr(temp(IDX_50_DAY_MOVING_AVERAGE)) + + WriteMACD_8_17Days.run i, CStr(temp(IDX_MACD_8_17_DAYS)) + WriteMACD_12_25Days.run i, CStr(temp(IDX_MACD_12_25_DAYS)) + + WriteEarningsPerShare.run i, CStr(temp(IDX_EARNINGS_PER_SHARE)) + WriteFundFlow.run i, CStr(temp(IDX_FUND_FLOW)) + WritePERatioExpected.run i, CStr(temp(IDX_P_E_RATIO_EXPECTED)) + WriteShortSellingAmountRatio.run i, CStr(temp(IDX_SHORT_SELLING_AMOUNT_RATIO_)) + ' WriteStockCode.run i, CStr(temp(IDX_STOCK_CODE)) + WriteStockPrice.run i, CStr(temp(IDX_STOCK_PRICE)) + WriteYield.run i, CStr(temp(IDX_YIELD)) + + WriteStatus.run "update stock code " & CStr(stock_code) & " done" + else + WriteStockName.run i, CStr("stock code is empty") + + end if + next i + + ' debug.print test + WriteStatus.run "update all stock code done" + + +Done: + Debug.Print "hello done" + + Exit Sub + +eh: + Debug.Print "hello error" + +End Sub diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadCell.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadCell.bas new file mode 100644 index 00000000..99a30054 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadCell.bas @@ -0,0 +1,5 @@ +Attribute VB_Name = "ReadCell" +Function run() + Debug.Print "run" + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadCellValue.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadCellValue.bas new file mode 100644 index 00000000..3c367229 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadCellValue.bas @@ -0,0 +1,6 @@ +Attribute VB_Name = "ReadCellValue" +Function run(cell_addr As String) + + run =Worksheets(TARGET_SHEET).Range(cell_addr).Value + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadEarningsPerShare.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadEarningsPerShare.bas new file mode 100644 index 00000000..51f10851 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadEarningsPerShare.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadEarningsPerShare" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadFundFlow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadFundFlow.bas new file mode 100644 index 00000000..a4723791 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadFundFlow.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadFundFlow" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadMACD_12_25Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadMACD_12_25Days.bas new file mode 100644 index 00000000..6e3983d9 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadMACD_12_25Days.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadMACD_12_25Days" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadMacd_8_17Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadMacd_8_17Days.bas new file mode 100644 index 00000000..948dadc7 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadMacd_8_17Days.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadMacd_8_17Days" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadPERatioExpected.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadPERatioExpected.bas new file mode 100644 index 00000000..7d2e7fa9 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadPERatioExpected.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadPERatioExpected" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadRsi_10.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadRsi_10.bas new file mode 100644 index 00000000..1b92882e --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadRsi_10.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadRsi_10" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadRsi_14.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadRsi_14.bas new file mode 100644 index 00000000..24a846bf --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadRsi_14.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadRsi_14" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadRsi_20.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadRsi_20.bas new file mode 100644 index 00000000..c9cc657a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadRsi_20.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadRsi_20" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadShortSellingAmountRatio.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadShortSellingAmountRatio.bas new file mode 100644 index 00000000..abf5f31f --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadShortSellingAmountRatio.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadShortSellingAmountRatio" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadStockCode.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadStockCode.bas new file mode 100644 index 00000000..92142358 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadStockCode.bas @@ -0,0 +1,22 @@ +Attribute VB_Name = "ReadStockCode" +Option Explicit + +Function run(row as integer) + On Error GoTo eh + Dim temp as string + temp = Worksheets(TARGET_SHEET).Range(COL_STOCK_CODE & CStr(row)).Value + + if (temp = "") then + temp = -1 + end if + + run = temp +Done: + exit Function + +eh: + debug.print "ReadStockCode" + debug.print row + debug.print temp + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadStockName.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadStockName.bas new file mode 100644 index 00000000..0080391d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadStockName.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadStockName" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadStockPrice.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadStockPrice.bas new file mode 100644 index 00000000..0be2afb4 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadStockPrice.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadStockPrice" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadYield.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadYield.bas new file mode 100644 index 00000000..93a1f76f --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ReadYield.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadYield" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Read_100DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Read_100DayMovingAverage.bas new file mode 100644 index 00000000..1b8e03f4 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Read_100DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_100DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Read_10DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Read_10DayMovingAverage.bas new file mode 100644 index 00000000..6473b178 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Read_10DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_10DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Read_20DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Read_20DayMovingAverage.bas new file mode 100644 index 00000000..cc083f34 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Read_20DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_20DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Read_250DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Read_250DayMovingAverage.bas new file mode 100644 index 00000000..6dfeb91c --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Read_250DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_250DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ThisWorkbook.cls b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ThisWorkbook.cls new file mode 100644 index 00000000..f1ba4358 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/ThisWorkbook.cls @@ -0,0 +1,5 @@ +Option Explicit + +Sub Helloworld() + Worksheets ("Sheet1") +End Sub diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteEarningsPerShare.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteEarningsPerShare.bas new file mode 100644 index 00000000..7b034b10 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteEarningsPerShare.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteEarningsPerShare" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_EARNINGS_PER_SHARE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteEarningsPerShare" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteFundFlow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteFundFlow.bas new file mode 100644 index 00000000..22869c15 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteFundFlow.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteFundFlow" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_FUND_FLOW & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteFundFlow" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteMACD_12_25Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteMACD_12_25Days.bas new file mode 100644 index 00000000..422f81eb --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteMACD_12_25Days.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteMACD_12_25Days" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_MACD_12_25_DAYS & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteMACD_12_25Days" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteMacd_8_17Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteMacd_8_17Days.bas new file mode 100644 index 00000000..876cb7ab --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteMacd_8_17Days.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteMACD_8_17Days" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_MACD_8_17_DAYS & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteMACD_8_17Days" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WritePERatioExpected.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WritePERatioExpected.bas new file mode 100644 index 00000000..a061a249 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WritePERatioExpected.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WritePERatioExpected" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_P_E_RATIO_EXPECTED & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WritePERatioExpected" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteRsi_10.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteRsi_10.bas new file mode 100644 index 00000000..7ac4223f --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteRsi_10.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteRsi_10" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI_10 & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteRsi_10" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteRsi_14.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteRsi_14.bas new file mode 100644 index 00000000..ca7cfc8f --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteRsi_14.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteRsi_14" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI_14 & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteRsi_14" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteRsi_20.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteRsi_20.bas new file mode 100644 index 00000000..9535b4bd --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteRsi_20.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteRsi_20" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI_20 & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteRsi_20" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteShortSellingAmountRatio.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteShortSellingAmountRatio.bas new file mode 100644 index 00000000..d2361913 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteShortSellingAmountRatio.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteShortSellingAmountRatio" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_SHORT_SELLING_AMOUNT_RATIO_ & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteShortSellingAmountRatio" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteStatus.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteStatus.bas new file mode 100644 index 00000000..8b2ceb29 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteStatus.bas @@ -0,0 +1,15 @@ +Attribute VB_Name = "WriteStatus" +Option Explicit + +Function run( content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range("A1").Value = content + +Done: + exit Function + +eh: + debug.print "WriteStatus" + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteStockCode.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteStockCode.bas new file mode 100644 index 00000000..bf83fe74 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteStockCode.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteStockCode" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_STOCK_CODE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteStockCode" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteStockName.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteStockName.bas new file mode 100644 index 00000000..fd78ddc0 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteStockName.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteStockName" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_STOCK_NAME & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteStockName" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteStockPrice.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteStockPrice.bas new file mode 100644 index 00000000..d8653e4d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteStockPrice.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteStockPrice" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_STOCK_PRICE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteStockPrice" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteYield.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteYield.bas new file mode 100644 index 00000000..39524039 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/WriteYield.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteYield" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_YIELD & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "WriteYield" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_100DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_100DayMovingAverage.bas new file mode 100644 index 00000000..9a1a0afc --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_100DayMovingAverage.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "Write_100DayMovingAverage" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_100_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "Write_100DayMovingAverage" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_10DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_10DayMovingAverage.bas new file mode 100644 index 00000000..0a3fb29d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_10DayMovingAverage.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "Write_10DayMovingAverage" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_10_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "Write_10DayMovingAverage" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_20DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_20DayMovingAverage.bas new file mode 100644 index 00000000..3473032a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_20DayMovingAverage.bas @@ -0,0 +1,6 @@ +Attribute VB_Name = "Write_20DayMovingAverage" +Option Explicit + +Function run() + Debug.Print "Helloworld Write_20DayMovingAverage" +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_250DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_250DayMovingAverage.bas new file mode 100644 index 00000000..ef1370f4 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_250DayMovingAverage.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "Write_250DayMovingAverage" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_250_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "Write_250DayMovingAverage" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_50DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_50DayMovingAverage.bas new file mode 100644 index 00000000..def73f37 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/Write_50DayMovingAverage.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "Write_50DayMovingAverage" +Option Explicit + +Function run(row as integer, content as string) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_50_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + exit Function + +eh: + debug.print "Write_50DayMovingAverage" + debug.print row + debug.print content + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/dev.bat b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/dev.bat new file mode 100644 index 00000000..3c8e31ec --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/dev.bat @@ -0,0 +1,5 @@ +@REM start excel by yourself + +@REM ./test.xlsm + +xlwings vba edit diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/package.json b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/package.json new file mode 100644 index 00000000..720880d6 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/package.json @@ -0,0 +1,13 @@ +{ + "name": "hello-error", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "gitUpdate":"git add . && git commit -m\"update,\"" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/test.xlsm b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/test.xlsm new file mode 100644 index 00000000..891ad1d9 Binary files /dev/null and b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-aastock/test.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/Config.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/Config.bas new file mode 100644 index 00000000..44350700 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/Config.bas @@ -0,0 +1,9 @@ +Attribute VB_Name = "Config" +Option Explicit + +Global ChromiumBinaryPath as string + +Sub init + ChromiumBinaryPath = "C:\Users\logic\AppData\Local\Chromium\Application\chrome.exe" + +end sub \ No newline at end of file diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/Helloworld.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/Helloworld.bas new file mode 100644 index 00000000..95efd7ad --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/Helloworld.bas @@ -0,0 +1,28 @@ +Attribute VB_Name = "Helloworld" +Option Explicit + +Dim driver As New WebDriver +Dim rowc, cc, columnC As Integer + +Sub helloworld() + On Error GoTo eh + + Config.init + + driver.SetBinary ChromiumBinaryPath + driver.Start "chrome" + + driver.Get "http://www.google.com" + + Application.Wait Now + TimeValue("00:00:01") + +Done: + debug.print "hello done" + driver.quit + + exit sub + +eh: + debug.print "hello error" + +End Sub diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/dev.bat b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/dev.bat new file mode 100644 index 00000000..3c8e31ec --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/dev.bat @@ -0,0 +1,5 @@ +@REM start excel by yourself + +@REM ./test.xlsm + +xlwings vba edit diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/package.json b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/package.json new file mode 100644 index 00000000..720880d6 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/package.json @@ -0,0 +1,13 @@ +{ + "name": "hello-error", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "gitUpdate":"git add . && git commit -m\"update,\"" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/test.xlsm b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/test.xlsm new file mode 100644 index 00000000..95042cdf Binary files /dev/null and b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-error/test.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/CheckLastRow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/CheckLastRow.bas new file mode 100644 index 00000000..4ea6d45c --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/CheckLastRow.bas @@ -0,0 +1,7 @@ +Attribute VB_Name = "CheckLastRow" +Option Explicit + +Function run() + Debug.Print "Helloworld CheckLastRow" +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Config.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Config.bas new file mode 100644 index 00000000..a2514312 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Config.bas @@ -0,0 +1,113 @@ +Attribute VB_Name = "Config" + +Global TARGET_SHEET As String +Global ROW_START As Integer + +Global ChromiumBinaryPath As String + +Global COL_STOCK_CODE As String +Global COL_STOCK_NAME As String +Global COL_STOCK_PRICE As String +Global COL_10_DAY_MOVING_AVERAGE As String +Global COL_20_DAY_MOVING_AVERAGE As String +Global COL_50_DAY_MOVING_AVERAGE As String +Global COL_100_DAY_MOVING_AVERAGE As String +Global COL_250_DAY_MOVING_AVERAGE As String +Global COL_P_E_RATIO_EXPECTED As String +Global COL_EARNINGS_PER_SHARE As String +Global COL_YIELD As String +Global COL_FUND_FLOW As String +Global COL_SHORT_SELLING_AMOUNT_RATIO_ As String +Global COL_RSI_10 As String +Global COL_RSI_14 As String +Global COL_RSI_20 As String +Global COL_MACD_8_17_DAYS As String +Global COL_MACD_12_25_DAYS As String + +Global IDX_STOCK_CODE As Integer +Global IDX_STOCK_NAME As Integer +Global IDX_STOCK_PRICE As Integer +Global IDX_10_DAY_MOVING_AVERAGE As Integer +Global IDX_20_DAY_MOVING_AVERAGE As Integer +Global IDX_50_DAY_MOVING_AVERAGE As Integer +Global IDX_100_DAY_MOVING_AVERAGE As Integer +Global IDX_250_DAY_MOVING_AVERAGE As Integer +Global IDX_P_E_RATIO_EXPECTED As Integer +Global IDX_EARNINGS_PER_SHARE As Integer +Global IDX_YIELD As Integer +Global IDX_FUND_FLOW As Integer +Global IDX_SHORT_SELLING_AMOUNT_RATIO_ As Integer +Global IDX_RSI_10 As Integer +Global IDX_RSI_14 As Integer +Global IDX_RSI_20 As Integer +Global IDX_MACD_8_17_DAYS As Integer +Global IDX_MACD_12_25_DAYS As Integer + + +Global COL_RESULT As String + +GLOBAL COL_10SMA_DIFF_20SMA AS STRING +GLOBAL COL_20SMA_DIFF_50SMA AS STRING +GLOBAL COL_50SMA_DIFF_100SMA AS STRING +GLOBAL COL_RSI10_DIFF_RSI14 AS STRING +GLOBAL COL_RSI10_DIFF_RSI20 AS STRING + +Sub init() + ChromiumBinaryPath = "C:\Users\logic\AppData\Local\Chromium\Application\chrome.exe" + + TARGET_SHEET = "Sheet1" + + ROW_START = 11 + + COL_STOCK_CODE = "A" + COL_STOCK_NAME = "B" + COL_STOCK_PRICE = "C" + COL_10_DAY_MOVING_AVERAGE = "D" + COL_20_DAY_MOVING_AVERAGE = "E" + COL_50_DAY_MOVING_AVERAGE = "F" + COL_100_DAY_MOVING_AVERAGE = "G" + COL_250_DAY_MOVING_AVERAGE = "H" + + + COL_10SMA_DIFF_20SMA = "I" + COL_10SMA_DIFF_20SMA = "I" + COL_20SMA_DIFF_50SMA = "J" + COL_50SMA_DIFF_100SMA = "K" + COL_RSI10_DIFF_RSI14 = "T" + COL_RSI10_DIFF_RSI20 = "U" + + + COL_P_E_RATIO_EXPECTED = "L" + COL_EARNINGS_PER_SHARE = "M" + COL_YIELD = "N" + COL_FUND_FLOW = "O" + COL_SHORT_SELLING_AMOUNT_RATIO_ = "P" + COL_RSI_10 = "Q" + COL_RSI_14 = "R" + COL_RSI_20 = "S" + COL_MACD_8_17_DAYS = "V" + COL_MACD_12_25_DAYS = "W" + + COL_RESULT = "AE" + + IDX_STOCK_CODE = 0 + IDX_STOCK_PRICE = 1 + IDX_STOCK_NAME = 2 + IDX_10_DAY_MOVING_AVERAGE = 4 + IDX_20_DAY_MOVING_AVERAGE = 5 + IDX_50_DAY_MOVING_AVERAGE = 6 + IDX_100_DAY_MOVING_AVERAGE = 7 + IDX_250_DAY_MOVING_AVERAGE = 8 + IDX_P_E_RATIO_EXPECTED = 9 + IDX_EARNINGS_PER_SHARE = 10 + IDX_YIELD = 11 + IDX_FUND_FLOW = 12 + IDX_SHORT_SELLING_AMOUNT_RATIO_ = 13 + IDX_RSI_10 = 14 + IDX_RSI_14 = 15 + IDX_RSI_20 = 16 + IDX_MACD_8_17_DAYS = 17 + IDX_MACD_12_25_DAYS = 18 + +End Sub + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/FetchAaStock.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/FetchAaStock.bas new file mode 100644 index 00000000..cd911042 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/FetchAaStock.bas @@ -0,0 +1,93 @@ +Attribute VB_Name = "FetchAaStock" + +Function run(stock_num As Integer) + ' On Error GoTo eh + + Dim fetch_result(0 To 22) As String + + Dim driver As New ChromeDriver + + driver.SetBinary ChromiumBinaryPath + driver.AddArgument "--disable-blink-features=AutomationControlled" + + driver.Start + + ' ' driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})") + ' ' driver.ExecuteScript "alert('helloworld')" + driver.ExecuteScript "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})" + + + ' ' driver.Get "http://localhost:8080/navigator_webdriver_test.html" + ' ' https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html + ' driver.Get "https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html" + + ' driver.ExecuteScript "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})" + + driver.Get "http://www.aastocks.com" + ' driver.ExecuteScript "console.log('hello excel')" + driver.ExecuteScript "document.querySelector('#sb-txtSymbol-aa').value = '" & stock_num & "'" + driver.ExecuteScript "document.querySelector('#sb-btnSubmit').click()" + driver.ExecuteScript "document.querySelectorAll('span.float_l')[6].click()" + + Debug.Print driver.ExecuteScript("{ return 'helloworld from chrome' }") + + ' stock_Name # Name + fetch_result(IDX_STOCK_NAME) = driver.ExecuteScript("{ return document.querySelector('#SQ_Name').textContent.trim() }") + + ' stock_Price # Price + fetch_result(IDX_STOCK_PRICE) = driver.ExecuteScript("{ return document.querySelector('#labelLast').textContent.trim() }") + + ' 10_day_Moving_Average # 10???? + fetch_result(IDX_10_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[1].querySelectorAll('td')[1].textContent.trim() }") + + ' 20_day_Moving_Average # 20???? + fetch_result(IDX_20_DAY_MOVING_AVERAGE) = "20_day_Moving_Average missing" + + ' 50_day_Moving_Average # 50???? + fetch_result(IDX_50_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[2].querySelectorAll('td')[1].textContent.trim() }") + + ' 100_day_Moving_Average # 100???? + fetch_result(IDX_100_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[3].querySelectorAll('td')[1].textContent.trim() }") + + ' 250_day_Moving_Average # 250???? + fetch_result(IDX_250_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[4].querySelectorAll('td')[1].textContent.trim() }") + + ' P_E_Ratio_Expected # ???/?? + fetch_result(IDX_P_E_RATIO_EXPECTED) = driver.ExecuteScript("{ return document.querySelectorAll('#tbPERatio div')[5].textContent.trim() }") + + ' Yield # ??? + fetch_result(IDX_YIELD) = driver.ExecuteScript("{ return document.querySelectorAll('.quote-box div')[19].textContent.trim() }") + + ' Fund_Flow # ???? + fetch_result(IDX_FUND_FLOW) = driver.ExecuteScript("{ return document.querySelectorAll('.quote-box div')[29].textContent.trim() }") + + ' Short_Selling_Amount_Ratio_% # ???_??(%) + fetch_result(IDX_SHORT_SELLING_AMOUNT_RATIO_) = driver.ExecuteScript("{ return document.querySelectorAll('.quote-box div')[4].textContent.trim() }") + + ' RSI_10 # RSI 10 + fetch_result(IDX_RSI_10) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[0].querySelector('.txt_r').textContent.trim() }") + + ' RSI_14 # RSI 14 + fetch_result(IDX_RSI_14) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[1].querySelector('.txt_r').textContent.trim() }") + + ' RSI_20 # RSI 20 + fetch_result(IDX_RSI_20) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[2].querySelector('.txt_r').textContent.trim() }") + + ' MACD_8_17_days # MACD(8_17 ?) + fetch_result(IDX_MACD_8_17_DAYS) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[2].querySelector('.txt_r').textContent.trim() }") + + ' MACD_12_25_days # MACD(12/25 ?) + fetch_result(IDX_MACD_12_25_DAYS) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[3].querySelector('.txt_r').textContent.trim() }") + + ' Application.Wait Now + TimeValue("00:30:01") + driver.Quit + + run = fetch_result +Done: + ' Debug.Print "hello done" + Exit Function + +eh: + Debug.Print "hello error" + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/FetchEtnet.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/FetchEtnet.bas new file mode 100644 index 00000000..8459deff --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/FetchEtnet.bas @@ -0,0 +1,51 @@ +Attribute VB_Name = "FetchEtnet" + +Function run(stock_num As Integer) + ' On Error GoTo eh + + Dim fetch_result(0 To 22) As String + + Dim driver As New ChromeDriver + + driver.SetBinary ChromiumBinaryPath + driver.AddArgument "--disable-blink-features=AutomationControlled" + + driver.Start + + driver.ExecuteScript "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})" + + driver.Get "https://www.etnet.com.hk/www/tc/stocks/realtime/quote.php" + driver.ExecuteScript "document.querySelector('#quotesearch').value = '" & stock_num & "'" + driver.ExecuteScript "document.querySelector('#quotesearch_submit').click()" + 'driver.ExecuteScript "document.querySelectorAll('span.float_l')[6].click()" + + driver.FindElementByCss "#StkList", 30 + + ' 10_day_Moving_Average # 10???? + fetch_result(IDX_10_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelector('#StkList').querySelectorAll('li.value')[1].textContent.trim() }") + + ' 20_day_Moving_Average # 20???? + fetch_result(IDX_20_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelector('#StkList').querySelectorAll('li.value')[3].textContent.trim() }") + + ' 50_day_Moving_Average # 50???? + fetch_result(IDX_50_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelector('#StkList').querySelectorAll('li.value')[5].textContent.trim() }") + + ' 100_day_Moving_Average # 100???? + fetch_result(IDX_100_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelector('#StkList').querySelectorAll('li.value')[7].textContent.trim() }") + + ' 250_day_Moving_Average # 250???? + fetch_result(IDX_250_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelector('#StkList').querySelectorAll('li.value')[9].textContent.trim() }") + + ' Earnings_per_Share # ?????? + fetch_result(IDX_EARNINGS_PER_SHARE) = driver.ExecuteScript("{ return document.querySelector('#StkList').querySelectorAll('li.value')[26].textContent.trim() }") + + ' Application.Wait Now + TimeValue("00:00:5") + run = fetch_result +Done: + ' Debug.Print "hello done" + Exit Function + +eh: + Debug.Print "hello error" + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/GetLastCheckRow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/GetLastCheckRow.bas new file mode 100644 index 00000000..67f8d286 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/GetLastCheckRow.bas @@ -0,0 +1,6 @@ +Attribute VB_Name = "GetLastCheckRow" +Function run(first_row As Integer) + getLastCheckRow = first_row + 10 +End Function + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/GetLastRow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/GetLastRow.bas new file mode 100644 index 00000000..fb0b494e --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/GetLastRow.bas @@ -0,0 +1,69 @@ +Attribute VB_Name = "GetLastRow" + +Function run(start_row As Integer) + On Error GoTo eh + Dim last_row As Boolean + + Dim last_check_row As Integer + last_check_row = 9999 + Dim scan_row As Integer + scan_row = start_row + + + Dim next_row_1 As Integer + Dim next_row_2 As Integer + Dim next_row_3 As Integer + Dim next_row_4 As Integer + Dim next_row_5 As Integer + + For i = start_row To last_check_row + scan_row = i + last_row = True + + next_row_1 = i + 1 + next_row_2 = i + 2 + next_row_3 = i + 3 + next_row_4 = i + 4 + next_row_5 = i + 5 + + cell_value_1 = ReadCellValue.run("A" & CStr(next_row_1)) + cell_value_2 = ReadCellValue.run("A" & CStr(next_row_2)) + cell_value_3 = ReadCellValue.run("A" & CStr(next_row_3)) + cell_value_4 = ReadCellValue.run("A" & CStr(next_row_4)) + cell_value_5 = ReadCellValue.run("A" & CStr(next_row_5)) + + If (cell_value_1 <> "") Then + last_row = False + ElseIf (cell_value_2 <> "") Then + last_row = False + ElseIf (cell_value_3 <> "") Then + last_row = False + ElseIf (cell_value_4 <> "") Then + last_row = False + ElseIf (cell_value_5 <> "") Then + last_row = False + Else + Debug.Print "done ?" + End If + + + If (last_row = True) Then + Debug.Print "last row found" + + Exit For + End If + + Next i + + run = scan_row +Done: + + Exit Function + +eh: + Debug.Print "WriteStatus" + Debug.Print content + +End Function + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Helloworld.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Helloworld.bas new file mode 100644 index 00000000..feb33dfe --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Helloworld.bas @@ -0,0 +1,96 @@ +Attribute VB_Name = "Helloworld" +Option Explicit + +Dim rowc, cc, columnC As Integer +Dim last_row As Integer +Dim i As Integer +Dim stock_code As Integer + +Dim temp As Variant +Dim etnet_temp As Variant + +Sub helloworld() + ' On Error GoTo eh + + WriteStatus.run "init config" + Config.init + WriteStatus.run "init config done" + + ' find last row + last_row = GetLastRow.run(11) + 'last_row = 23 + Debug.Print last_row + + For i = ROW_START To last_row + stock_code = CInt(ReadStockCode.run(i)) + + If (stock_code > -1) Then + temp = FetchAaStock.run(stock_code) + etnet_temp = FetchEtnet.run(stock_code) + + ' WriteStatus.run "updateing stock code " & CStr(stock_code) & "..." + + ' WriteStockName.run i, CStr(temp(IDX_STOCK_NAME)) + Write_10DayMovingAverage.run i, CStr(etnet_temp(IDX_10_DAY_MOVING_AVERAGE)) + Write_20DayMovingAverage.run i, CStr(etnet_temp(IDX_20_DAY_MOVING_AVERAGE)) + Write_50DayMovingAverage.run i, CStr(etnet_temp(IDX_50_DAY_MOVING_AVERAGE)) + Write_100DayMovingAverage.run i, CStr(etnet_temp(IDX_100_DAY_MOVING_AVERAGE)) + Write_250DayMovingAverage.run i, CStr(etnet_temp(IDX_250_DAY_MOVING_AVERAGE)) + + WriteRsi_10.run i, CStr(temp(IDX_RSI_10)) + WriteRsi_14.run i, CStr(temp(IDX_RSI_14)) + WriteRsi_20.run i, CStr(temp(IDX_RSI_20)) + + WriteMACD_8_17Days.run i, CStr(temp(IDX_MACD_8_17_DAYS)) + WriteMACD_12_25Days.run i, CStr(temp(IDX_MACD_12_25_DAYS)) + + WriteEarningsPerShare.run i, CStr(etnet_temp(IDX_EARNINGS_PER_SHARE)) + WriteFundFlow.run i, CStr(temp(IDX_FUND_FLOW)) + WritePERatioExpected.run i, CStr(temp(IDX_P_E_RATIO_EXPECTED)) + WriteShortSellingAmountRatio.run i, CStr(temp(IDX_SHORT_SELLING_AMOUNT_RATIO_)) + ' WriteStockCode.run i, CStr(temp(IDX_STOCK_CODE)) + WriteStockPrice.run i, CStr(temp(IDX_STOCK_PRICE)) + WriteYield.run i, CStr(temp(IDX_YIELD)) + WriteStockName.run i, CStr(temp(IDX_STOCK_NAME)) + + 'calculation + ' D-E + Write_10SMA_diff_20SMA.run i, CStr(etnet_temp(IDX_10_DAY_MOVING_AVERAGE) - etnet_temp(IDX_20_DAY_MOVING_AVERAGE)) + + ' E-F + Write_20SMA_diff_50SMA.run i, CStr(etnet_temp(IDX_20_DAY_MOVING_AVERAGE) - etnet_temp(IDX_50_DAY_MOVING_AVERAGE)) + + ' F-G + Write_50SMA_diff_100SMA.run i, CStr(etnet_temp(IDX_50_DAY_MOVING_AVERAGE) - etnet_temp(IDX_100_DAY_MOVING_AVERAGE)) + + ' Q-R + Write_RSI10_diff_RSI14.run i, CStr(temp(IDX_RSI_10) - temp(IDX_RSI_14)) + + ' Q-S + Write_RSI10_diff_RSI20.run i, CStr(temp(IDX_RSI_10) - temp(IDX_RSI_20)) + + + + WriteStatus.run "update stock code " & CStr(stock_code) & " done" + Else + WriteStockName.run i, CStr("stock code is empty") + + End If + Next i + + ' debug.print test + WriteStatus.run "update all stock code done" + + +Done: + Worksheets(TARGET_SHEET).Columns("A:AZ").EntireColumn.AutoFit + Worksheets(TARGET_SHEET).Rows("11:9999").EntireRow.AutoFit + Debug.Print "hello done" + + Exit Sub + +eh: + Debug.Print "hello error" + +End Sub + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadCell.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadCell.bas new file mode 100644 index 00000000..99a30054 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadCell.bas @@ -0,0 +1,5 @@ +Attribute VB_Name = "ReadCell" +Function run() + Debug.Print "run" + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadCellValue.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadCellValue.bas new file mode 100644 index 00000000..a48008d8 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadCellValue.bas @@ -0,0 +1,7 @@ +Attribute VB_Name = "ReadCellValue" +Function run(cell_addr As String) + + run = Worksheets(TARGET_SHEET).Range(cell_addr).Value + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadEarningsPerShare.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadEarningsPerShare.bas new file mode 100644 index 00000000..51f10851 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadEarningsPerShare.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadEarningsPerShare" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadFundFlow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadFundFlow.bas new file mode 100644 index 00000000..a4723791 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadFundFlow.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadFundFlow" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadMACD_12_25Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadMACD_12_25Days.bas new file mode 100644 index 00000000..6e3983d9 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadMACD_12_25Days.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadMACD_12_25Days" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadMacd_8_17Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadMacd_8_17Days.bas new file mode 100644 index 00000000..948dadc7 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadMacd_8_17Days.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadMacd_8_17Days" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadPERatioExpected.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadPERatioExpected.bas new file mode 100644 index 00000000..7d2e7fa9 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadPERatioExpected.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadPERatioExpected" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadRsi_10.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadRsi_10.bas new file mode 100644 index 00000000..1b92882e --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadRsi_10.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadRsi_10" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadRsi_14.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadRsi_14.bas new file mode 100644 index 00000000..24a846bf --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadRsi_14.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadRsi_14" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadRsi_20.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadRsi_20.bas new file mode 100644 index 00000000..c9cc657a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadRsi_20.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadRsi_20" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadShortSellingAmountRatio.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadShortSellingAmountRatio.bas new file mode 100644 index 00000000..abf5f31f --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadShortSellingAmountRatio.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadShortSellingAmountRatio" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadStockCode.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadStockCode.bas new file mode 100644 index 00000000..93fe16e1 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadStockCode.bas @@ -0,0 +1,23 @@ +Attribute VB_Name = "ReadStockCode" +Option Explicit + +Function run(row As Integer) + On Error GoTo eh + Dim temp As String + temp = Worksheets(TARGET_SHEET).Range(COL_STOCK_CODE & CStr(row)).Value + + If (temp = "") Then + temp = -1 + End If + + run = temp +Done: + Exit Function + +eh: + Debug.Print "ReadStockCode" + Debug.Print row + Debug.Print temp + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadStockName.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadStockName.bas new file mode 100644 index 00000000..0080391d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadStockName.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadStockName" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadStockPrice.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadStockPrice.bas new file mode 100644 index 00000000..0be2afb4 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadStockPrice.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadStockPrice" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadYield.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadYield.bas new file mode 100644 index 00000000..93a1f76f --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ReadYield.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadYield" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Read_100DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Read_100DayMovingAverage.bas new file mode 100644 index 00000000..1b8e03f4 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Read_100DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_100DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Read_10DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Read_10DayMovingAverage.bas new file mode 100644 index 00000000..d7cf7452 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Read_10DayMovingAverage.bas @@ -0,0 +1,7 @@ +Attribute VB_Name = "Read_10DayMovingAverage" +Option Explicit + +Function run() + Debug.Print "Helloworld Read_10DayMovingAverage" +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Read_20DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Read_20DayMovingAverage.bas new file mode 100644 index 00000000..cc083f34 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Read_20DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_20DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Read_250DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Read_250DayMovingAverage.bas new file mode 100644 index 00000000..6dfeb91c --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Read_250DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_250DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ThisWorkbook.cls b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ThisWorkbook.cls new file mode 100644 index 00000000..ef4d8f6a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/ThisWorkbook.cls @@ -0,0 +1,5 @@ +Option Explicit + +Sub helloworld() + Worksheets ("Sheet1") +End Sub diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteEarningsPerShare.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteEarningsPerShare.bas new file mode 100644 index 00000000..5db475cb --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteEarningsPerShare.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteEarningsPerShare" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_EARNINGS_PER_SHARE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteEarningsPerShare" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteFundFlow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteFundFlow.bas new file mode 100644 index 00000000..83440f5d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteFundFlow.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteFundFlow" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_FUND_FLOW & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteFundFlow" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteMACD_12_25Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteMACD_12_25Days.bas new file mode 100644 index 00000000..67e8d905 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteMACD_12_25Days.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteMACD_12_25Days" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_MACD_12_25_DAYS & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteMACD_12_25Days" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteMACD_8_17Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteMACD_8_17Days.bas new file mode 100644 index 00000000..25ebb004 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteMACD_8_17Days.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteMACD_8_17Days" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_MACD_8_17_DAYS & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteMACD_8_17Days" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WritePERatioExpected.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WritePERatioExpected.bas new file mode 100644 index 00000000..d3b506d3 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WritePERatioExpected.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WritePERatioExpected" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_P_E_RATIO_EXPECTED & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WritePERatioExpected" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteRsi_10.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteRsi_10.bas new file mode 100644 index 00000000..63ccc642 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteRsi_10.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteRsi_10" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI_10 & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteRsi_10" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteRsi_14.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteRsi_14.bas new file mode 100644 index 00000000..ca92641d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteRsi_14.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteRsi_14" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI_14 & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteRsi_14" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteRsi_20.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteRsi_20.bas new file mode 100644 index 00000000..55c7f3f2 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteRsi_20.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteRsi_20" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI_20 & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteRsi_20" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteShortSellingAmountRatio.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteShortSellingAmountRatio.bas new file mode 100644 index 00000000..6dd507aa --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteShortSellingAmountRatio.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteShortSellingAmountRatio" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_SHORT_SELLING_AMOUNT_RATIO_ & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteShortSellingAmountRatio" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteStatus.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteStatus.bas new file mode 100644 index 00000000..5aa363de --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteStatus.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteStatus" +Option Explicit + +Function run(content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range("A1").Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteStatus" + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteStockCode.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteStockCode.bas new file mode 100644 index 00000000..b1d34858 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteStockCode.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteStockCode" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_STOCK_CODE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteStockCode" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteStockName.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteStockName.bas new file mode 100644 index 00000000..2b1d8628 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteStockName.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteStockName" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_STOCK_NAME & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteStockName" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteStockPrice.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteStockPrice.bas new file mode 100644 index 00000000..46d5c8e1 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteStockPrice.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteStockPrice" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_STOCK_PRICE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteStockPrice" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteYield.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteYield.bas new file mode 100644 index 00000000..81a424d7 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/WriteYield.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteYield" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_YIELD & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteYield" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_100DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_100DayMovingAverage.bas new file mode 100644 index 00000000..7ee6e3c9 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_100DayMovingAverage.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "Write_100DayMovingAverage" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_100_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "Write_100DayMovingAverage" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_10DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_10DayMovingAverage.bas new file mode 100644 index 00000000..99d9075a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_10DayMovingAverage.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "Write_10DayMovingAverage" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_10_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "Write_10DayMovingAverage" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_10SMA_diff_20SMA.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_10SMA_diff_20SMA.bas new file mode 100644 index 00000000..4577bbc7 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_10SMA_diff_20SMA.bas @@ -0,0 +1,21 @@ +Attribute VB_Name = "Write_10SMA_diff_20SMA" +Option Explicit + + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_10SMA_DIFF_20SMA & CStr(row)).Value = content + + Worksheets(TARGET_SHEET).Range(COL_10SMA_DIFF_20SMA & CStr(row)).NumberFormat = "0.000" + +Done: + Exit Function + +eh: + Debug.Print "Write_10DayMovingAverage" + Debug.Print row + Debug.Print content + +End Function + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_20DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_20DayMovingAverage.bas new file mode 100644 index 00000000..906d1301 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_20DayMovingAverage.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "Write_20DayMovingAverage" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_20_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "Write_20DayMovingAverage" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_20SMA_diff_50SMA.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_20SMA_diff_50SMA.bas new file mode 100644 index 00000000..d23db24d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_20SMA_diff_50SMA.bas @@ -0,0 +1,22 @@ +Attribute VB_Name = "Write_20SMA_diff_50SMA" +Option Explicit + + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_20SMA_DIFF_50SMA & CStr(row)).Value = content + + Worksheets(TARGET_SHEET).Range(COL_20SMA_DIFF_50SMA & CStr(row)).NumberFormat = "0.000" + +Done: + Exit Function + +eh: + Debug.Print "Write_20SMA_diff_50SMA" + Debug.Print row + Debug.Print content + +End Function + + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_250DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_250DayMovingAverage.bas new file mode 100644 index 00000000..8f43a485 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_250DayMovingAverage.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "Write_250DayMovingAverage" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_250_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "Write_250DayMovingAverage" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_50DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_50DayMovingAverage.bas new file mode 100644 index 00000000..fe190144 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_50DayMovingAverage.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "Write_50DayMovingAverage" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_50_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "Write_50DayMovingAverage" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_50SMA_diff_100SMA.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_50SMA_diff_100SMA.bas new file mode 100644 index 00000000..b3ce0639 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_50SMA_diff_100SMA.bas @@ -0,0 +1,22 @@ +Attribute VB_Name = "Write_50SMA_diff_100SMA" +Option Explicit + + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_50SMA_DIFF_100SMA & CStr(row)).Value = content + + Worksheets(TARGET_SHEET).Range(COL_50SMA_DIFF_100SMA & CStr(row)).NumberFormat = "0.000" + +Done: + Exit Function + +eh: + Debug.Print "Write_50SMA_diff_100SMA" + Debug.Print row + Debug.Print content + +End Function + + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_RSI10_diff_RSI14.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_RSI10_diff_RSI14.bas new file mode 100644 index 00000000..c32a4eef --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_RSI10_diff_RSI14.bas @@ -0,0 +1,22 @@ +Attribute VB_Name = "Write_RSI10_diff_RSI14" +Option Explicit + + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI10_DIFF_RSI14 & CStr(row)).Value = content + + Worksheets(TARGET_SHEET).Range(COL_RSI10_DIFF_RSI14 & CStr(row)).NumberFormat = "0.000" + +Done: + Exit Function + +eh: + Debug.Print "Write_RSI10_diff_RSI14" + Debug.Print row + Debug.Print content + +End Function + + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_RSI10_diff_RSI20.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_RSI10_diff_RSI20.bas new file mode 100644 index 00000000..5b7b1097 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/Write_RSI10_diff_RSI20.bas @@ -0,0 +1,22 @@ +Attribute VB_Name = "Write_RSI10_diff_RSI20" +Option Explicit + + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI10_DIFF_RSI20 & CStr(row)).Value = content + + Worksheets(TARGET_SHEET).Range(COL_RSI10_DIFF_RSI20 & CStr(row)).NumberFormat = "0.000" + +Done: + Exit Function + +eh: + Debug.Print "Write_RSI10_diff_RSI20" + Debug.Print row + Debug.Print content + +End Function + + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/test.xlsm b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/test.xlsm new file mode 100644 index 00000000..d3c73e0e Binary files /dev/null and b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-etnet/test.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/CheckLastRow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/CheckLastRow.bas new file mode 100644 index 00000000..4ea6d45c --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/CheckLastRow.bas @@ -0,0 +1,7 @@ +Attribute VB_Name = "CheckLastRow" +Option Explicit + +Function run() + Debug.Print "Helloworld CheckLastRow" +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Config.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Config.bas new file mode 100644 index 00000000..a2514312 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Config.bas @@ -0,0 +1,113 @@ +Attribute VB_Name = "Config" + +Global TARGET_SHEET As String +Global ROW_START As Integer + +Global ChromiumBinaryPath As String + +Global COL_STOCK_CODE As String +Global COL_STOCK_NAME As String +Global COL_STOCK_PRICE As String +Global COL_10_DAY_MOVING_AVERAGE As String +Global COL_20_DAY_MOVING_AVERAGE As String +Global COL_50_DAY_MOVING_AVERAGE As String +Global COL_100_DAY_MOVING_AVERAGE As String +Global COL_250_DAY_MOVING_AVERAGE As String +Global COL_P_E_RATIO_EXPECTED As String +Global COL_EARNINGS_PER_SHARE As String +Global COL_YIELD As String +Global COL_FUND_FLOW As String +Global COL_SHORT_SELLING_AMOUNT_RATIO_ As String +Global COL_RSI_10 As String +Global COL_RSI_14 As String +Global COL_RSI_20 As String +Global COL_MACD_8_17_DAYS As String +Global COL_MACD_12_25_DAYS As String + +Global IDX_STOCK_CODE As Integer +Global IDX_STOCK_NAME As Integer +Global IDX_STOCK_PRICE As Integer +Global IDX_10_DAY_MOVING_AVERAGE As Integer +Global IDX_20_DAY_MOVING_AVERAGE As Integer +Global IDX_50_DAY_MOVING_AVERAGE As Integer +Global IDX_100_DAY_MOVING_AVERAGE As Integer +Global IDX_250_DAY_MOVING_AVERAGE As Integer +Global IDX_P_E_RATIO_EXPECTED As Integer +Global IDX_EARNINGS_PER_SHARE As Integer +Global IDX_YIELD As Integer +Global IDX_FUND_FLOW As Integer +Global IDX_SHORT_SELLING_AMOUNT_RATIO_ As Integer +Global IDX_RSI_10 As Integer +Global IDX_RSI_14 As Integer +Global IDX_RSI_20 As Integer +Global IDX_MACD_8_17_DAYS As Integer +Global IDX_MACD_12_25_DAYS As Integer + + +Global COL_RESULT As String + +GLOBAL COL_10SMA_DIFF_20SMA AS STRING +GLOBAL COL_20SMA_DIFF_50SMA AS STRING +GLOBAL COL_50SMA_DIFF_100SMA AS STRING +GLOBAL COL_RSI10_DIFF_RSI14 AS STRING +GLOBAL COL_RSI10_DIFF_RSI20 AS STRING + +Sub init() + ChromiumBinaryPath = "C:\Users\logic\AppData\Local\Chromium\Application\chrome.exe" + + TARGET_SHEET = "Sheet1" + + ROW_START = 11 + + COL_STOCK_CODE = "A" + COL_STOCK_NAME = "B" + COL_STOCK_PRICE = "C" + COL_10_DAY_MOVING_AVERAGE = "D" + COL_20_DAY_MOVING_AVERAGE = "E" + COL_50_DAY_MOVING_AVERAGE = "F" + COL_100_DAY_MOVING_AVERAGE = "G" + COL_250_DAY_MOVING_AVERAGE = "H" + + + COL_10SMA_DIFF_20SMA = "I" + COL_10SMA_DIFF_20SMA = "I" + COL_20SMA_DIFF_50SMA = "J" + COL_50SMA_DIFF_100SMA = "K" + COL_RSI10_DIFF_RSI14 = "T" + COL_RSI10_DIFF_RSI20 = "U" + + + COL_P_E_RATIO_EXPECTED = "L" + COL_EARNINGS_PER_SHARE = "M" + COL_YIELD = "N" + COL_FUND_FLOW = "O" + COL_SHORT_SELLING_AMOUNT_RATIO_ = "P" + COL_RSI_10 = "Q" + COL_RSI_14 = "R" + COL_RSI_20 = "S" + COL_MACD_8_17_DAYS = "V" + COL_MACD_12_25_DAYS = "W" + + COL_RESULT = "AE" + + IDX_STOCK_CODE = 0 + IDX_STOCK_PRICE = 1 + IDX_STOCK_NAME = 2 + IDX_10_DAY_MOVING_AVERAGE = 4 + IDX_20_DAY_MOVING_AVERAGE = 5 + IDX_50_DAY_MOVING_AVERAGE = 6 + IDX_100_DAY_MOVING_AVERAGE = 7 + IDX_250_DAY_MOVING_AVERAGE = 8 + IDX_P_E_RATIO_EXPECTED = 9 + IDX_EARNINGS_PER_SHARE = 10 + IDX_YIELD = 11 + IDX_FUND_FLOW = 12 + IDX_SHORT_SELLING_AMOUNT_RATIO_ = 13 + IDX_RSI_10 = 14 + IDX_RSI_14 = 15 + IDX_RSI_20 = 16 + IDX_MACD_8_17_DAYS = 17 + IDX_MACD_12_25_DAYS = 18 + +End Sub + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/FetchAaStock.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/FetchAaStock.bas new file mode 100644 index 00000000..acb4bca5 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/FetchAaStock.bas @@ -0,0 +1,103 @@ +Attribute VB_Name = "FetchAaStock" + +Function run(stock_num As Integer) + ' On Error GoTo eh + + Dim fetch_result(0 To 22) As String + + Dim driver As New ChromeDriver + + driver.SetBinary ChromiumBinaryPath + driver.AddArgument "--disable-blink-features=AutomationControlled" + + driver.Start + + ' ' driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})") + ' ' driver.ExecuteScript "alert('helloworld')" + driver.ExecuteScript "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})" + + + ' ' driver.Get "http://localhost:8080/navigator_webdriver_test.html" + ' ' https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html + ' driver.Get "https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html" + + ' driver.ExecuteScript "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})" + + driver.Get "http://www.aastocks.com" + ' driver.ExecuteScript "console.log('hello excel')" + driver.FindElementByCss "#sb-txtSymbol-aa", 120 + driver.FindElementByCss "#sb-btnSubmit", 120 + driver.ExecuteScript "document.querySelector('#sb-txtSymbol-aa').value = '" & stock_num & "'" + driver.ExecuteScript "document.querySelector('#sb-btnSubmit').click()" + + driver.FindElementByCss "div.tab div.tab-bg:nth-child(2)", 120 + driver.ExecuteScript "document.querySelector('div.tab div.tab-bg:nth-child(2)').click()" + ' Debug.Print driver.ExecuteScript("{ return 'helloworld from chrome' }") + + ' stock_Name # Name + driver.FindElementByCss "#SQ_Name", 120 + driver.FindElementByCss "#labelLast", 120 + driver.FindElementByCss ".content.comm-panel.dq-panel", 120 + driver.FindElementByCss "#tbPERatio div", 120 + driver.FindElementByCss "#labelLast", 120 + driver.FindElementByCss ".quote-box div", 120 + driver.FindElementByCss ".content.comm-panel", 120 + fetch_result(IDX_STOCK_NAME) = driver.ExecuteScript("{ return document.querySelector('#SQ_Name').textContent.trim() }") + + ' stock_Price # Price + fetch_result(IDX_STOCK_PRICE) = driver.ExecuteScript("{ return document.querySelector('#labelLast').textContent.trim() }") + + ' 10_day_Moving_Average # 10???? + fetch_result(IDX_10_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[1].querySelectorAll('td')[1].textContent.trim() }") + + ' 20_day_Moving_Average # 20???? + fetch_result(IDX_20_DAY_MOVING_AVERAGE) = "20_day_Moving_Average missing" + + ' 50_day_Moving_Average # 50???? + fetch_result(IDX_50_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[2].querySelectorAll('td')[1].textContent.trim() }") + + ' 100_day_Moving_Average # 100???? + fetch_result(IDX_100_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[3].querySelectorAll('td')[1].textContent.trim() }") + + ' 250_day_Moving_Average # 250???? + fetch_result(IDX_250_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel.dq-panel')[1].querySelectorAll('tr')[4].querySelectorAll('td')[1].textContent.trim() }") + + ' P_E_Ratio_Expected # ???/?? + fetch_result(IDX_P_E_RATIO_EXPECTED) = driver.ExecuteScript("{ return document.querySelectorAll('#tbPERatio div')[5].textContent.trim() }") + + ' Yield # ??? + fetch_result(IDX_YIELD) = driver.ExecuteScript("{ return document.querySelectorAll('.quote-box div')[19].textContent.trim() }") + + ' Fund_Flow # ???? + fetch_result(IDX_FUND_FLOW) = driver.ExecuteScript("{ return document.querySelectorAll('.quote-box div')[29].textContent.trim() }") + + ' Short_Selling_Amount_Ratio_% # ???_??(%) + fetch_result(IDX_SHORT_SELLING_AMOUNT_RATIO_) = driver.ExecuteScript("{ return document.querySelectorAll('.quote-box div')[4].textContent.trim() }") + + ' RSI_10 # RSI 10 + fetch_result(IDX_RSI_10) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[0].querySelector('.txt_r').textContent.trim() }") + + ' RSI_14 # RSI 14 + fetch_result(IDX_RSI_14) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[1].querySelector('.txt_r').textContent.trim() }") + + ' RSI_20 # RSI 20 + fetch_result(IDX_RSI_20) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[2].querySelector('.txt_r').textContent.trim() }") + + ' MACD_8_17_days # MACD(8_17 ?) + fetch_result(IDX_MACD_8_17_DAYS) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[2].querySelector('.txt_r').textContent.trim() }") + + ' MACD_12_25_days # MACD(12/25 ?) + fetch_result(IDX_MACD_12_25_DAYS) = driver.ExecuteScript("{ return document.querySelectorAll('.content.comm-panel')[7].querySelectorAll('table')[0].querySelectorAll('tr')[3].querySelector('.txt_r').textContent.trim() }") + + ' Application.Wait Now + TimeValue("00:30:01") + driver.Quit + + run = fetch_result +Done: + ' Debug.Print "hello done" + Exit Function + +eh: + Debug.Print "hello error" + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/FetchEtnet.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/FetchEtnet.bas new file mode 100644 index 00000000..32557e25 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/FetchEtnet.bas @@ -0,0 +1,51 @@ +Attribute VB_Name = "FetchEtnet" + +Function run(stock_num As Integer) + ' On Error GoTo eh + + Dim fetch_result(0 To 22) As String + + Dim driver As New ChromeDriver + + driver.SetBinary ChromiumBinaryPath + driver.AddArgument "--disable-blink-features=AutomationControlled" + + driver.Start + + driver.ExecuteScript "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})" + + driver.Get "https://www.etnet.com.hk/www/tc/stocks/realtime/quote.php" + driver.ExecuteScript "document.querySelector('#quotesearch').value = '" & stock_num & "'" + driver.ExecuteScript "document.querySelector('#quotesearch_submit').click()" + 'driver.ExecuteScript "document.querySelectorAll('span.float_l')[6].click()" + + driver.FindElementByCss "#StkList", 120 + + ' 10_day_Moving_Average # 10???? + fetch_result(IDX_10_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelector('#StkList').querySelectorAll('li.value')[1].textContent.trim() }") + + ' 20_day_Moving_Average # 20???? + fetch_result(IDX_20_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelector('#StkList').querySelectorAll('li.value')[3].textContent.trim() }") + + ' 50_day_Moving_Average # 50???? + fetch_result(IDX_50_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelector('#StkList').querySelectorAll('li.value')[5].textContent.trim() }") + + ' 100_day_Moving_Average # 100???? + fetch_result(IDX_100_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelector('#StkList').querySelectorAll('li.value')[7].textContent.trim() }") + + ' 250_day_Moving_Average # 250???? + fetch_result(IDX_250_DAY_MOVING_AVERAGE) = driver.ExecuteScript("{ return document.querySelector('#StkList').querySelectorAll('li.value')[9].textContent.trim() }") + + ' Earnings_per_Share # ?????? + fetch_result(IDX_EARNINGS_PER_SHARE) = driver.ExecuteScript("{ return document.querySelector('#StkList').querySelectorAll('li.value')[26].textContent.trim() }") + + ' Application.Wait Now + TimeValue("00:00:5") + run = fetch_result +Done: + ' Debug.Print "hello done" + Exit Function + +eh: + Debug.Print "hello error" + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/GetLastCheckRow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/GetLastCheckRow.bas new file mode 100644 index 00000000..67f8d286 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/GetLastCheckRow.bas @@ -0,0 +1,6 @@ +Attribute VB_Name = "GetLastCheckRow" +Function run(first_row As Integer) + getLastCheckRow = first_row + 10 +End Function + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/GetLastRow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/GetLastRow.bas new file mode 100644 index 00000000..fb0b494e --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/GetLastRow.bas @@ -0,0 +1,69 @@ +Attribute VB_Name = "GetLastRow" + +Function run(start_row As Integer) + On Error GoTo eh + Dim last_row As Boolean + + Dim last_check_row As Integer + last_check_row = 9999 + Dim scan_row As Integer + scan_row = start_row + + + Dim next_row_1 As Integer + Dim next_row_2 As Integer + Dim next_row_3 As Integer + Dim next_row_4 As Integer + Dim next_row_5 As Integer + + For i = start_row To last_check_row + scan_row = i + last_row = True + + next_row_1 = i + 1 + next_row_2 = i + 2 + next_row_3 = i + 3 + next_row_4 = i + 4 + next_row_5 = i + 5 + + cell_value_1 = ReadCellValue.run("A" & CStr(next_row_1)) + cell_value_2 = ReadCellValue.run("A" & CStr(next_row_2)) + cell_value_3 = ReadCellValue.run("A" & CStr(next_row_3)) + cell_value_4 = ReadCellValue.run("A" & CStr(next_row_4)) + cell_value_5 = ReadCellValue.run("A" & CStr(next_row_5)) + + If (cell_value_1 <> "") Then + last_row = False + ElseIf (cell_value_2 <> "") Then + last_row = False + ElseIf (cell_value_3 <> "") Then + last_row = False + ElseIf (cell_value_4 <> "") Then + last_row = False + ElseIf (cell_value_5 <> "") Then + last_row = False + Else + Debug.Print "done ?" + End If + + + If (last_row = True) Then + Debug.Print "last row found" + + Exit For + End If + + Next i + + run = scan_row +Done: + + Exit Function + +eh: + Debug.Print "WriteStatus" + Debug.Print content + +End Function + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/HighlightRow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/HighlightRow.bas new file mode 100644 index 00000000..0e566f41 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/HighlightRow.bas @@ -0,0 +1,43 @@ +Attribute VB_Name = "HighlightRow" +Option Explicit + +function resetColor(cell as variant) + cell.Interior.Color = rgb(255,255,255) + resetColor = true +end function + + +function setColor(cell as variant) + cell.Interior.Color = rgb(255, 234, 167) + setColor = true +end function + +Function run(row As Integer) + On Error GoTo eh + Dim need_highlight as boolean + Dim rsi_10_14_diff_positive as boolean + Dim macd_12_25_positive as boolean + need_highlight = false + + 'need to highlight ? + rsi_10_14_diff_positive = Worksheets(TARGET_SHEET).Range(COL_RSI10_DIFF_RSI14 & CStr(row)) > 0 + macd_12_25_positive = Worksheets(TARGET_SHEET).Range(COL_MACD_12_25_DAYS & CStr(row)) > 0 + need_highlight = rsi_10_14_diff_positive and macd_12_25_positive + + if (need_highlight = True) then + HighlightRow.setColor Worksheets(TARGET_SHEET).Range(COL_STOCK_CODE & CStr(row) & ":" & COL_MACD_12_25_DAYS & CStr(row)) + else + HighlightRow.resetColor Worksheets(TARGET_SHEET).Range(COL_STOCK_CODE & CStr(row) & ":" & COL_MACD_12_25_DAYS & CStr(row)) + end if + +Done: + Exit Function + +eh: + Debug.Print "HighlightRow" + Debug.Print row + +End Function + + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Main.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Main.bas new file mode 100644 index 00000000..7f7df9d1 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Main.bas @@ -0,0 +1,99 @@ +Attribute VB_Name = "Main" +Option Explicit + +Dim rowc, cc, columnC As Integer +Dim last_row As Integer +Dim i As Integer +Dim stock_code As Integer + +Dim temp As Variant +Dim etnet_temp As Variant + +Sub main() + ' On Error GoTo eh + + WriteStatus.run "init config" + Config.init + WriteStatus.run "init config done" + + ' find last row + last_row = GetLastRow.run(11) + 'last_row = 23 + Debug.Print last_row + + For i = ROW_START To last_row + stock_code = CInt(ReadStockCode.run(i)) + + If (stock_code > -1) Then + temp = FetchAaStock.run(stock_code) + etnet_temp = FetchEtnet.run(stock_code) + + ' WriteStatus.run "updateing stock code " & CStr(stock_code) & "..." + + ' WriteStockName.run i, CStr(temp(IDX_STOCK_NAME)) + Write_10DayMovingAverage.run i, CStr(etnet_temp(IDX_10_DAY_MOVING_AVERAGE)) + Write_20DayMovingAverage.run i, CStr(etnet_temp(IDX_20_DAY_MOVING_AVERAGE)) + Write_50DayMovingAverage.run i, CStr(etnet_temp(IDX_50_DAY_MOVING_AVERAGE)) + Write_100DayMovingAverage.run i, CStr(etnet_temp(IDX_100_DAY_MOVING_AVERAGE)) + Write_250DayMovingAverage.run i, CStr(etnet_temp(IDX_250_DAY_MOVING_AVERAGE)) + + WriteRsi_10.run i, CStr(temp(IDX_RSI_10)) + WriteRsi_14.run i, CStr(temp(IDX_RSI_14)) + WriteRsi_20.run i, CStr(temp(IDX_RSI_20)) + + WriteMACD_8_17Days.run i, CStr(temp(IDX_MACD_8_17_DAYS)) + WriteMACD_12_25Days.run i, CStr(temp(IDX_MACD_12_25_DAYS)) + + WriteEarningsPerShare.run i, CStr(etnet_temp(IDX_EARNINGS_PER_SHARE)) + WriteFundFlow.run i, CStr(temp(IDX_FUND_FLOW)) + WritePERatioExpected.run i, CStr(temp(IDX_P_E_RATIO_EXPECTED)) + WriteShortSellingAmountRatio.run i, CStr(temp(IDX_SHORT_SELLING_AMOUNT_RATIO_)) + ' WriteStockCode.run i, CStr(temp(IDX_STOCK_CODE)) + WriteStockPrice.run i, CStr(temp(IDX_STOCK_PRICE)) + WriteYield.run i, CStr(temp(IDX_YIELD)) + WriteStockName.run i, CStr(temp(IDX_STOCK_NAME)) + + 'calculation + ' D-E + Write_10SMA_diff_20SMA.run i, CStr(etnet_temp(IDX_10_DAY_MOVING_AVERAGE) - etnet_temp(IDX_20_DAY_MOVING_AVERAGE)) + + ' E-F + Write_20SMA_diff_50SMA.run i, CStr(etnet_temp(IDX_20_DAY_MOVING_AVERAGE) - etnet_temp(IDX_50_DAY_MOVING_AVERAGE)) + + ' F-G + Write_50SMA_diff_100SMA.run i, CStr(etnet_temp(IDX_50_DAY_MOVING_AVERAGE) - etnet_temp(IDX_100_DAY_MOVING_AVERAGE)) + + ' Q-R + Write_RSI10_diff_RSI14.run i, CStr(temp(IDX_RSI_10) - temp(IDX_RSI_14)) + + ' Q-S + Write_RSI10_diff_RSI20.run i, CStr(temp(IDX_RSI_10) - temp(IDX_RSI_20)) + + + HighlightRow.run i + + + WriteStatus.run "update stock code " & CStr(stock_code) & " done" + Else + WriteStockName.run i, CStr("stock code is empty") + + End If + Next i + + ' debug.print test + WriteStatus.run "update all stock code done" + + +Done: + Worksheets(TARGET_SHEET).Columns("A:AZ").EntireColumn.AutoFit + Worksheets(TARGET_SHEET).Rows("11:9999").EntireRow.AutoFit + Debug.Print "hello done" + + Exit Sub + +eh: + Debug.Print "hello error" + +End Sub + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Module1.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Module1.bas new file mode 100644 index 00000000..aa8e0bec --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Module1.bas @@ -0,0 +1,31 @@ +Attribute VB_Name = "Module1" +Sub Macro1() +Attribute Macro1.VB_ProcData.VB_Invoke_Func = " \n14" +' +' Macro1 Macro +' + +' + Selection.NumberFormat = "0.000" +End Sub +Sub Macro2() +Attribute Macro2.VB_ProcData.VB_Invoke_Func = " \n14" +' +' Macro2 Macro +' + +' + Worksheets("Sheet1").Columns("A:AZ").EntireColumn.AutoFit + +End Sub +Sub Macro3() +Attribute Macro3.VB_ProcData.VB_Invoke_Func = " \n14" +' +' Macro3 Macro +' + +' + Rows("11:11").EntireRow.AutoFit + Rows("11:11").RowHeight = 71.25 + Rows("11:11").EntireRow.AutoFit +End Sub diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadCell.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadCell.bas new file mode 100644 index 00000000..99a30054 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadCell.bas @@ -0,0 +1,5 @@ +Attribute VB_Name = "ReadCell" +Function run() + Debug.Print "run" + +End Function diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadCellValue.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadCellValue.bas new file mode 100644 index 00000000..a48008d8 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadCellValue.bas @@ -0,0 +1,7 @@ +Attribute VB_Name = "ReadCellValue" +Function run(cell_addr As String) + + run = Worksheets(TARGET_SHEET).Range(cell_addr).Value + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadEarningsPerShare.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadEarningsPerShare.bas new file mode 100644 index 00000000..51f10851 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadEarningsPerShare.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadEarningsPerShare" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadFundFlow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadFundFlow.bas new file mode 100644 index 00000000..a4723791 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadFundFlow.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadFundFlow" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadMACD_12_25Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadMACD_12_25Days.bas new file mode 100644 index 00000000..6e3983d9 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadMACD_12_25Days.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadMACD_12_25Days" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadMacd_8_17Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadMacd_8_17Days.bas new file mode 100644 index 00000000..948dadc7 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadMacd_8_17Days.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadMacd_8_17Days" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadPERatioExpected.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadPERatioExpected.bas new file mode 100644 index 00000000..7d2e7fa9 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadPERatioExpected.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadPERatioExpected" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadRsi_10.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadRsi_10.bas new file mode 100644 index 00000000..1b92882e --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadRsi_10.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadRsi_10" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadRsi_14.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadRsi_14.bas new file mode 100644 index 00000000..24a846bf --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadRsi_14.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadRsi_14" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadRsi_20.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadRsi_20.bas new file mode 100644 index 00000000..c9cc657a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadRsi_20.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadRsi_20" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadShortSellingAmountRatio.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadShortSellingAmountRatio.bas new file mode 100644 index 00000000..abf5f31f --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadShortSellingAmountRatio.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadShortSellingAmountRatio" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadStockCode.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadStockCode.bas new file mode 100644 index 00000000..93fe16e1 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadStockCode.bas @@ -0,0 +1,23 @@ +Attribute VB_Name = "ReadStockCode" +Option Explicit + +Function run(row As Integer) + On Error GoTo eh + Dim temp As String + temp = Worksheets(TARGET_SHEET).Range(COL_STOCK_CODE & CStr(row)).Value + + If (temp = "") Then + temp = -1 + End If + + run = temp +Done: + Exit Function + +eh: + Debug.Print "ReadStockCode" + Debug.Print row + Debug.Print temp + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadStockName.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadStockName.bas new file mode 100644 index 00000000..0080391d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadStockName.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadStockName" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadStockPrice.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadStockPrice.bas new file mode 100644 index 00000000..0be2afb4 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadStockPrice.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadStockPrice" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadYield.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadYield.bas new file mode 100644 index 00000000..93a1f76f --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ReadYield.bas @@ -0,0 +1 @@ +Attribute VB_Name = "ReadYield" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Read_100DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Read_100DayMovingAverage.bas new file mode 100644 index 00000000..1b8e03f4 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Read_100DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_100DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Read_10DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Read_10DayMovingAverage.bas new file mode 100644 index 00000000..d7cf7452 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Read_10DayMovingAverage.bas @@ -0,0 +1,7 @@ +Attribute VB_Name = "Read_10DayMovingAverage" +Option Explicit + +Function run() + Debug.Print "Helloworld Read_10DayMovingAverage" +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Read_20DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Read_20DayMovingAverage.bas new file mode 100644 index 00000000..cc083f34 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Read_20DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_20DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Read_250DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Read_250DayMovingAverage.bas new file mode 100644 index 00000000..6dfeb91c --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Read_250DayMovingAverage.bas @@ -0,0 +1 @@ +Attribute VB_Name = "Read_250DayMovingAverage" diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ThisWorkbook.cls b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ThisWorkbook.cls new file mode 100644 index 00000000..ef4d8f6a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/ThisWorkbook.cls @@ -0,0 +1,5 @@ +Option Explicit + +Sub helloworld() + Worksheets ("Sheet1") +End Sub diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteEarningsPerShare.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteEarningsPerShare.bas new file mode 100644 index 00000000..5db475cb --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteEarningsPerShare.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteEarningsPerShare" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_EARNINGS_PER_SHARE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteEarningsPerShare" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteFundFlow.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteFundFlow.bas new file mode 100644 index 00000000..83440f5d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteFundFlow.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteFundFlow" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_FUND_FLOW & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteFundFlow" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteMACD_12_25Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteMACD_12_25Days.bas new file mode 100644 index 00000000..67e8d905 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteMACD_12_25Days.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteMACD_12_25Days" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_MACD_12_25_DAYS & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteMACD_12_25Days" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteMACD_8_17Days.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteMACD_8_17Days.bas new file mode 100644 index 00000000..25ebb004 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteMACD_8_17Days.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteMACD_8_17Days" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_MACD_8_17_DAYS & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteMACD_8_17Days" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WritePERatioExpected.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WritePERatioExpected.bas new file mode 100644 index 00000000..d3b506d3 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WritePERatioExpected.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WritePERatioExpected" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_P_E_RATIO_EXPECTED & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WritePERatioExpected" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteRsi_10.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteRsi_10.bas new file mode 100644 index 00000000..63ccc642 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteRsi_10.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteRsi_10" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI_10 & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteRsi_10" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteRsi_14.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteRsi_14.bas new file mode 100644 index 00000000..ca92641d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteRsi_14.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteRsi_14" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI_14 & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteRsi_14" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteRsi_20.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteRsi_20.bas new file mode 100644 index 00000000..55c7f3f2 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteRsi_20.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteRsi_20" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI_20 & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteRsi_20" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteShortSellingAmountRatio.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteShortSellingAmountRatio.bas new file mode 100644 index 00000000..6dd507aa --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteShortSellingAmountRatio.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteShortSellingAmountRatio" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_SHORT_SELLING_AMOUNT_RATIO_ & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteShortSellingAmountRatio" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteStatus.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteStatus.bas new file mode 100644 index 00000000..5aa363de --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteStatus.bas @@ -0,0 +1,16 @@ +Attribute VB_Name = "WriteStatus" +Option Explicit + +Function run(content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range("A1").Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteStatus" + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteStockCode.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteStockCode.bas new file mode 100644 index 00000000..b1d34858 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteStockCode.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteStockCode" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_STOCK_CODE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteStockCode" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteStockName.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteStockName.bas new file mode 100644 index 00000000..2b1d8628 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteStockName.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteStockName" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_STOCK_NAME & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteStockName" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteStockPrice.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteStockPrice.bas new file mode 100644 index 00000000..46d5c8e1 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteStockPrice.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteStockPrice" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_STOCK_PRICE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteStockPrice" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteYield.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteYield.bas new file mode 100644 index 00000000..81a424d7 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/WriteYield.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "WriteYield" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_YIELD & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "WriteYield" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_100DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_100DayMovingAverage.bas new file mode 100644 index 00000000..7ee6e3c9 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_100DayMovingAverage.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "Write_100DayMovingAverage" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_100_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "Write_100DayMovingAverage" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_10DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_10DayMovingAverage.bas new file mode 100644 index 00000000..99d9075a --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_10DayMovingAverage.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "Write_10DayMovingAverage" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_10_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "Write_10DayMovingAverage" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_10SMA_diff_20SMA.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_10SMA_diff_20SMA.bas new file mode 100644 index 00000000..4577bbc7 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_10SMA_diff_20SMA.bas @@ -0,0 +1,21 @@ +Attribute VB_Name = "Write_10SMA_diff_20SMA" +Option Explicit + + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_10SMA_DIFF_20SMA & CStr(row)).Value = content + + Worksheets(TARGET_SHEET).Range(COL_10SMA_DIFF_20SMA & CStr(row)).NumberFormat = "0.000" + +Done: + Exit Function + +eh: + Debug.Print "Write_10DayMovingAverage" + Debug.Print row + Debug.Print content + +End Function + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_20DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_20DayMovingAverage.bas new file mode 100644 index 00000000..906d1301 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_20DayMovingAverage.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "Write_20DayMovingAverage" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_20_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "Write_20DayMovingAverage" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_20SMA_diff_50SMA.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_20SMA_diff_50SMA.bas new file mode 100644 index 00000000..d23db24d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_20SMA_diff_50SMA.bas @@ -0,0 +1,22 @@ +Attribute VB_Name = "Write_20SMA_diff_50SMA" +Option Explicit + + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_20SMA_DIFF_50SMA & CStr(row)).Value = content + + Worksheets(TARGET_SHEET).Range(COL_20SMA_DIFF_50SMA & CStr(row)).NumberFormat = "0.000" + +Done: + Exit Function + +eh: + Debug.Print "Write_20SMA_diff_50SMA" + Debug.Print row + Debug.Print content + +End Function + + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_250DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_250DayMovingAverage.bas new file mode 100644 index 00000000..8f43a485 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_250DayMovingAverage.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "Write_250DayMovingAverage" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_250_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "Write_250DayMovingAverage" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_50DayMovingAverage.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_50DayMovingAverage.bas new file mode 100644 index 00000000..fe190144 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_50DayMovingAverage.bas @@ -0,0 +1,17 @@ +Attribute VB_Name = "Write_50DayMovingAverage" +Option Explicit + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_50_DAY_MOVING_AVERAGE & CStr(row)).Value = content + +Done: + Exit Function + +eh: + Debug.Print "Write_50DayMovingAverage" + Debug.Print row + Debug.Print content + +End Function + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_50SMA_diff_100SMA.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_50SMA_diff_100SMA.bas new file mode 100644 index 00000000..b3ce0639 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_50SMA_diff_100SMA.bas @@ -0,0 +1,22 @@ +Attribute VB_Name = "Write_50SMA_diff_100SMA" +Option Explicit + + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_50SMA_DIFF_100SMA & CStr(row)).Value = content + + Worksheets(TARGET_SHEET).Range(COL_50SMA_DIFF_100SMA & CStr(row)).NumberFormat = "0.000" + +Done: + Exit Function + +eh: + Debug.Print "Write_50SMA_diff_100SMA" + Debug.Print row + Debug.Print content + +End Function + + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_RSI10_diff_RSI14.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_RSI10_diff_RSI14.bas new file mode 100644 index 00000000..c32a4eef --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_RSI10_diff_RSI14.bas @@ -0,0 +1,22 @@ +Attribute VB_Name = "Write_RSI10_diff_RSI14" +Option Explicit + + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI10_DIFF_RSI14 & CStr(row)).Value = content + + Worksheets(TARGET_SHEET).Range(COL_RSI10_DIFF_RSI14 & CStr(row)).NumberFormat = "0.000" + +Done: + Exit Function + +eh: + Debug.Print "Write_RSI10_diff_RSI14" + Debug.Print row + Debug.Print content + +End Function + + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_RSI10_diff_RSI20.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_RSI10_diff_RSI20.bas new file mode 100644 index 00000000..5b7b1097 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/Write_RSI10_diff_RSI20.bas @@ -0,0 +1,22 @@ +Attribute VB_Name = "Write_RSI10_diff_RSI20" +Option Explicit + + +Function run(row As Integer, content As String) + On Error GoTo eh + Worksheets(TARGET_SHEET).Range(COL_RSI10_DIFF_RSI20 & CStr(row)).Value = content + + Worksheets(TARGET_SHEET).Range(COL_RSI10_DIFF_RSI20 & CStr(row)).NumberFormat = "0.000" + +Done: + Exit Function + +eh: + Debug.Print "Write_RSI10_diff_RSI20" + Debug.Print row + Debug.Print content + +End Function + + + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/test.xlsm b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/test.xlsm new file mode 100644 index 00000000..8f0931f0 Binary files /dev/null and b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-formatting/test.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/Config.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/Config.bas new file mode 100644 index 00000000..44350700 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/Config.bas @@ -0,0 +1,9 @@ +Attribute VB_Name = "Config" +Option Explicit + +Global ChromiumBinaryPath as string + +Sub init + ChromiumBinaryPath = "C:\Users\logic\AppData\Local\Chromium\Application\chrome.exe" + +end sub \ No newline at end of file diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/Helloworld.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/Helloworld.bas new file mode 100644 index 00000000..69d62906 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/Helloworld.bas @@ -0,0 +1,41 @@ +Attribute VB_Name = "Helloworld" +Option Explicit + +Dim driver As New ChromeDriver +Dim rowc, cc, columnC As Integer + +Sub helloworld() + On Error GoTo eh + + Config.init + + driver.SetBinary ChromiumBinaryPath + + driver.Start + driver.AddArgument "--disable-blink-features=AutomationControlled" + + + ' driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})") + ' driver.ExecuteScript "alert('helloworld')" + ' driver.ExecuteScript "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})" + + + ' driver.Get "http://localhost:8080/navigator_webdriver_test.html" + ' https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html + ' driver.Get "https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html" + + driver.Get "http://www.aastocks.com" + + + Application.Wait Now + TimeValue("00:00:5") + +Done: + debug.print "hello done" + driver.quit + + exit sub + +eh: + debug.print "hello error" + +End Sub diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/dev.bat b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/dev.bat new file mode 100644 index 00000000..3c8e31ec --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/dev.bat @@ -0,0 +1,5 @@ +@REM start excel by yourself + +@REM ./test.xlsm + +xlwings vba edit diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/package.json b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/package.json new file mode 100644 index 00000000..720880d6 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/package.json @@ -0,0 +1,13 @@ +{ + "name": "hello-error", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "gitUpdate":"git add . && git commit -m\"update,\"" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/test.xlsm b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/test.xlsm new file mode 100644 index 00000000..6cd8a7c8 Binary files /dev/null and b/armandarmand/task1/task1-ticket1/helloworld/browser/hello-stealthing/test.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/helloworld/Module1.bas b/armandarmand/task1/task1-ticket1/helloworld/browser/helloworld/Module1.bas new file mode 100644 index 00000000..22362378 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/helloworld/Module1.bas @@ -0,0 +1,31 @@ +Attribute VB_Name = "Module1" + +option explicit + +' This subroutine is an example of how to use the WebDriver in VBA. +' It opens Chrome, navigates to a website and waits for 1 second. + +' @Precondition - WebDriver.exe and Chrome.exe are in the path. +' @Postcondition - Chrome is closed. +' @Throws - No exceptions are caught or handled. +' @See - https://github.com/florentbr/SeleniumBasic/blob/master/README.md +' @See - https://www.selenium.dev/documentation/en/webdriver/ +Public Sub HelloWorld() + ' Create a new instance of the WebDriver. + Dim driver As New WebDriver + + ' Set the path to the WebDriver executable. + driver.SetBinary "C:\Users\logic\AppData\Local\Chromium\Application\chrome.exe" + + ' Start Chrome. + driver.Start "chrome" + + ' Navigate to a website. + driver.Get "http://www.example.com" + + Application.Wait Now + TimeValue("00:00:03") + + ' Quit Chrome. + driver.Quit +End Sub + diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/helloworld/dev.bat b/armandarmand/task1/task1-ticket1/helloworld/browser/helloworld/dev.bat new file mode 100644 index 00000000..d64ea8d4 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/helloworld/browser/helloworld/dev.bat @@ -0,0 +1,5 @@ +@REM start excel by yourself + +@REM ./test.xlsm + +xlwings vba edit --file ./test.xlsm diff --git a/armandarmand/task1/task1-ticket1/helloworld/browser/helloworld/test.xlsm b/armandarmand/task1/task1-ticket1/helloworld/browser/helloworld/test.xlsm new file mode 100644 index 00000000..555ef105 Binary files /dev/null and b/armandarmand/task1/task1-ticket1/helloworld/browser/helloworld/test.xlsm differ diff --git a/armandarmand/task1/task1-ticket1/meta.md b/armandarmand/task1/task1-ticket1/meta.md new file mode 100644 index 00000000..2d54326d --- /dev/null +++ b/armandarmand/task1/task1-ticket1/meta.md @@ -0,0 +1,65 @@ +--- +tags: [vba, excel, stock-monitor] +--- + +# armandarmand + +## quotation + +HKD800 + +### notes + +### lesson learned + +- remember to install .net framework 3.5 (sp1 i tested on windows 10) + +### references + +https://github.com/VBA-tools/VBA-JSON + +https://www.mrexcel.com/board/threads/web-scraping-using-vba.1232175/ + +https://github.com/florentbr/SeleniumBasic/releases/tag/v2.0.9.0 + +https://github.com/longvh211/SeleniumBasic/releases/tag/v2.0.9.0 + +https://chromium.cypress.io/win64/stable/98.0.4758.102 + +### history + +translate the below into english, thanks + +大致上會係咁,你睇下有冇問題? +ttps://youtu.be/ljmjEc9x6MQ + +``` +stock_Code # Code +stock_Name # Name +stock_Price # Price +10_day_Moving_Average # 10天平均值 +20_day_Moving_Average # 20天平均值 +50_day_Moving_Average # 50天平均值 +100_day_Moving_Average # 100天平均值 +250_day_Moving_Average # 250天平均值 +P_E_Ratio_Expected # 市盈率/預期 +Earnings_per_Share # 每股帳面淨值 +Yield # 收益率 +Fund_Flow # 資金流向 +Short_Selling_Amount_Ratio_% # 沽空額_比率(%) +RSI_10 # RSI 10 +RSI_14 # RSI 14 +RSI_20 # RSI 20 +MACD_8_17_days # MACD(8_17 天) +MACD_12_25_days # MACD(12/25 天) +``` + + + +1. T 係 "Q-R, W 係 MACD (12/25), 呢兩個都係正數就成條 row highlight +1. D-E, E-F, 果幾條數 +1. etnet.com.hk 撈 SMA20 + +咁我汁一汁先,過兩日再搵你 +到時冇問題的話收埋尾數 +再開個 call 係你部機 setup 啦,好嘛? diff --git a/armandarmand/task1/task1-ticket1/package.json b/armandarmand/task1/task1-ticket1/package.json new file mode 100644 index 00000000..8b643dd7 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/package.json @@ -0,0 +1,13 @@ +{ + "name": "task1", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "gitUpdate": "git add . && git commit -m \"update,\"" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/armandarmand/task1/task1-ticket1/screenshot/eIn6V8zbH4.png b/armandarmand/task1/task1-ticket1/screenshot/eIn6V8zbH4.png new file mode 100644 index 00000000..68089a82 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/screenshot/eIn6V8zbH4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e98b41cfaa414cfb00722d59393a4dd20184883322aeb43b567a48ac8ff26d6e +size 189527 diff --git a/armandarmand/task1/task1-ticket1/screenshot/gAPs5ZBi8r.png b/armandarmand/task1/task1-ticket1/screenshot/gAPs5ZBi8r.png new file mode 100644 index 00000000..c2aedbe5 --- /dev/null +++ b/armandarmand/task1/task1-ticket1/screenshot/gAPs5ZBi8r.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5550864011ce5cc8155bcaa04fcbf360b578bdd16499341f6f82052b51d8bb6 +size 193157 diff --git a/armandarmand/task1/task1-ticket1/screenshot/ta4OAjLoT6.png b/armandarmand/task1/task1-ticket1/screenshot/ta4OAjLoT6.png new file mode 100644 index 00000000..155324af --- /dev/null +++ b/armandarmand/task1/task1-ticket1/screenshot/ta4OAjLoT6.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3fd0f0247929dd32a3799aa92f2a42da104e2acd852b1684da5b8b735e516c19 +size 196558 diff --git a/armandarmand/task1/task1-ticket2/.editorconfig b/armandarmand/task1/task1-ticket2/.editorconfig new file mode 100644 index 00000000..61451791 --- /dev/null +++ b/armandarmand/task1/task1-ticket2/.editorconfig @@ -0,0 +1,15 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = false + +[*.md] +trim_trailing_whitespace = false diff --git a/armandarmand/task1/task1-ticket2/.gitignore b/armandarmand/task1/task1-ticket2/.gitignore new file mode 100644 index 00000000..c0f7f01e --- /dev/null +++ b/armandarmand/task1/task1-ticket2/.gitignore @@ -0,0 +1,4 @@ +node_modules +**/~* +*.del +**/chrome-win/ \ No newline at end of file diff --git a/armandarmand/task1/task1-ticket2/.prettierrc b/armandarmand/task1/task1-ticket2/.prettierrc new file mode 100644 index 00000000..5b3a50ab --- /dev/null +++ b/armandarmand/task1/task1-ticket2/.prettierrc @@ -0,0 +1,18 @@ +{ + "arrowParens": "avoid", + "bracketSpacing": true, + "htmlWhitespaceSensitivity": "strict", + "insertPragma": false, + "jsxBracketSameLine": false, + "jsxSingleQuote": false, + "printWidth": 120, + "proseWrap": "preserve", + "quoteProps": "as-needed", + "requirePragma": false, + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "all", + "useTabs": false, + "overrides": [] +} diff --git a/armandarmand/task1/task1-ticket2/chrome_mrNdYKO77m.png b/armandarmand/task1/task1-ticket2/chrome_mrNdYKO77m.png new file mode 100644 index 00000000..0d00ac09 --- /dev/null +++ b/armandarmand/task1/task1-ticket2/chrome_mrNdYKO77m.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d433d72e64d4731fb4341984f98cce4517a78126f0c9baceb326f65bffc820c +size 29168 diff --git a/armandarmand/task1/task1-ticket2/excel_ws/test/edit.bat b/armandarmand/task1/task1-ticket2/excel_ws/test/edit.bat new file mode 100644 index 00000000..3f2f847d --- /dev/null +++ b/armandarmand/task1/task1-ticket2/excel_ws/test/edit.bat @@ -0,0 +1,3 @@ +rmdir *.bas + +xlwings vba edit --file .\main.xlsm diff --git a/armandarmand/task1/task1-ticket2/excel_ws/test/main.xlsm b/armandarmand/task1/task1-ticket2/excel_ws/test/main.xlsm new file mode 100644 index 00000000..5880eb6e Binary files /dev/null and b/armandarmand/task1/task1-ticket2/excel_ws/test/main.xlsm differ diff --git a/armandarmand/task1/task1-ticket2/meta.md b/armandarmand/task1/task1-ticket2/meta.md new file mode 100644 index 00000000..2b962531 --- /dev/null +++ b/armandarmand/task1/task1-ticket2/meta.md @@ -0,0 +1,23 @@ +--- +tags: [vba, excel, stock-monitor] +--- + +# armandarmand + +## quotation + +HKD100 for modification + +### notes + +### lesson learned + +N/A + +### references + +N/A + +### history + +N/A diff --git a/armandarmand/task1/task1-ticket2/package.json b/armandarmand/task1/task1-ticket2/package.json new file mode 100644 index 00000000..8b643dd7 --- /dev/null +++ b/armandarmand/task1/task1-ticket2/package.json @@ -0,0 +1,13 @@ +{ + "name": "task1", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "gitUpdate": "git add . && git commit -m \"update,\"" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/arzoonet/IMG-20231222-WA0003.jpg b/arzoonet/IMG-20231222-WA0003.jpg new file mode 100644 index 00000000..75c3c4b9 --- /dev/null +++ b/arzoonet/IMG-20231222-WA0003.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c7fca26354b8e59b5954285db7f12ba9b6e7ee97c0fc242d00dfbc810c4ded8 +size 113602 diff --git a/arzoonet/IMG_20231222_154316_567.webp b/arzoonet/IMG_20231222_154316_567.webp new file mode 100644 index 00000000..5b68fed6 Binary files /dev/null and b/arzoonet/IMG_20231222_154316_567.webp differ diff --git a/arzoonet/gitUpdate.bat b/arzoonet/gitUpdate.bat new file mode 100644 index 00000000..53708df6 --- /dev/null +++ b/arzoonet/gitUpdate.bat @@ -0,0 +1,7 @@ +git status . + +@pause + +git add . +git commit -m"update arzoonet," +start git push \ No newline at end of file diff --git a/arzoonet/notes.md b/arzoonet/notes.md new file mode 100644 index 00000000..cc511f61 --- /dev/null +++ b/arzoonet/notes.md @@ -0,0 +1,5 @@ +491 review 4.86 + +ok I will quote HKD500 for the excel format then. + +Probably may i ask HKD100 for the deposit if you are ok with the quote given?