Thursday, February 4, 2021

MAC Crontab testing

 MAC Crontab testing

28 * * * * cd ~/auspix && ./hello.sh

@reboot cd ~/auspix && ./hello2.sh

1. It won't run before the login, even if added into Login Items. (Unless enable auto login)

2. After login, it will run when the screen is locked or the user is switched

3. When MAC is power on, another user logins, the crontab user doesn't login yet, the crontab will run

4. Before the login, MAC screen shows GMT time instead of local time!


Tuesday, February 2, 2021

沪深股票自动交易之交易执行

自动交易大概可以分为数据获取、交易策略、回归测试以及交易执行,做为小散,CTP/FIX等不适用,破解通达信DLL,会担心安全问题,比较合适的还是控制键盘鼠标来执行交易。

拿我使用的华泰证券来说,之前一直用AutoIt来做交易,但这个有两个问题,一是华泰证券升级之后,得做相应的改动,比如拷贝数据要输入验证码什么的。另一个问题是,因为身在国外的原因,连接华泰证券各站点,速度慢且不稳定,ping起来最少也有200多ms,甚至不能ping通。后来发现有个python的easytrader,简单又好用,感谢作者shidenggui。

第二个问题,曾经试过用google cloud,但必须在云主机上在安装VirtualBox,在VirtualBox上安装Windows XP,直接在google cloud上断开远程桌面后自动化的UI无法执行(解决方法见后)。easytrader不支持windows XP,如果在云主机上再安装windows 7/10的话,需要云主机很好的配置才可能。具体可参见这篇文章:如何关闭远程桌面后仍处于可交互状态

前几天试了一下腾讯云,意外发现在腾讯云的1核 2GB 1Mbps的标准型SA2主机上运行起来如行云流水,ping值只有20多ms,而且通过这位仁兄介绍的方法,远程桌面断开后也工作的很好。另外一种方式是用如shengdenggui推荐的TightVNC。设置windows自动登录,然后在交易前重新启动一下机器,定时运行的交易程序也会照常运行。

for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (

  %windir%\System32\tscon.exe %%s /dest:console

)

Sunday, January 17, 2021

Windows 10 ARM for MAC M1

 

1. Download Windows 10 on ARM

https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64

Windows10_InsiderPreview_Client_ARM64_en-us_21286.VHDX

2. Download Parallels Desktop 16 for M1 Mac Technical Preview

https://my.parallels.com/desktop/beta

ParallelsDesktop-16.3.1-50393.dmg

3. Install PD and Windows 10

It only takes 9 minutes to install Windows 10 ARM

4. After restart, no internet, need to reinstall Prallels Tool


Verified it's very smooth to plan Leage of legends (FPS 120, Ping 22ms)

Able to use 华泰证券

It's not stable yet, but quite impressive.

Sunday, January 10, 2021

Angular note

 Udemy Angular - The Complete Guide (2020 Edition)

1. ng new my-first-app

n/n

   cd my-first-app

   ng serve

   http://localhost:4200/

2. ng new hello-cli

ng g c product --inline-style --inline-template --skipTests

will generate a single file, product.component.ts, with inlined styles and template and no test in the src/app/product directory,               

and add ProductComponent to the declarations property of @NgModule.

3. ng new ngAuction --prefix nga --routing

npm i bootstrap jquery popper.js --save-prod

ng serve -o

ng g c home

ng g c carousel

ng g c footer

ng g c navbar 

ng g c product-item 

ng g c product-detail 

ng g c search

ng g c stars

ng g s shared/product

    template: `

      <a [routerLink]="['/']">Home</a>                         

       <a [routerLink]="['/product']">Product Details</a>      

       <router-outlet></router-outlet>                         

     `           

4.

ng new angular-reddit  


Friday, January 8, 2021

English

 my soul is chaff when it's dampered by the blue light

Tuesday, December 15, 2020

Macbook air m1

 Macbook Air M1:

1. Cannot install/upgrade any apps from app store. (after click, grey)

2. Can I set my Macbook Air to Do nothing When I close the lid?

3. Cannot develop as no JDK for M1 chip? - wait for VM?

Booked the session with specialist.


Bell Hub 3000 USB can only recognize NTFS format, cannot identify exFAT or MAC format.

For NTFS USB, mac is able to read/write, however it's very slow. It takes 14 mins to copy a 1.47Gb file from mac to the USB on Bell Hub 3000.

It takes 3 mins to copy the same file from the Bell Hub 3000 to mac.

It only takes 1 min to upload and download from google drive in my network (500M Fiber).



Thursday, December 3, 2020

Oracle tidy DDL export

 

set serveroutput on

DECLARE

   V_DDL CLOB;

BEGIN

   DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'EMIT_SCHEMA',false);

   DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'PHYSICAL_PROPERTIES',false);

   DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SEGMENT_ATTRIBUTES',false);

   DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',false);

   DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false);

   DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'PRETTY', true);

   DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'TABLESPACE',false);

   V_DDL := DBMS_METADATA.GET_DDL('TABLE', 'VIL_POSTED_TRANSACTION_RAW');

   DBMS_OUTPUT.PUT_LINE(V_DDL); 

END;