Monday, March 4, 2024

miniQMT自动交易

 https://blog.csdn.net/u010214511/article/details/130275793

http://dict.thinktrader.net/nativeApi/code_examples.html

1. Install Python 3.11.8

2. Install xtquant: pip install quant1x-xtquant

3. 

登录QMT极简模式,连接QMT客户端:

import random

from xtquant.xttrader import XtQuantTrader

path = r'C:\国金证券QMT交易端\userdata_mini'

session_id = int(random.randint(100000,999999))

xt_trader = XtQuantTrader(path, session_id)

xt_trader.start()

connect_result=xt_trader.connect()

print(connect_result)

if connect_result == 0:

print('Connected successfully!')

订阅账户:

acc = StockAccount('888XXXXXXX')

subscribe_result=xt_trader.subscribe(acc)

print(subscribe_result)

下单:

stock_code='000429.SZ'

order_id=xt_trader.order_stock(acc,stock_code,xtconstant.STOCK_BUY,100,xtconstant.FIX_PRICE,9.3)

xt_trader.cancel_order_stock(acc,1082384002)


    asset = xt_trader.query_stock_asset(acc)

    if asset:

        print("asset:")

        print("cash {0}".format(asset.cash))

Friday, March 1, 2024

Breakpoint will not currently be hit. No symbols have been loaded for this document

 For C# Reflection/Dynamic loading module, got the message "Breakpoint will not currently be hit. No symbols have been loaded for this document" when trying to debug.

Already clean solution and rebuild, the below works for me

In VS, go to Tools --> Options --> Debugging --> General, and then cancel the checks in front of [Enable "Only My Code"] and [Require source files to exactly match the original version]. But this method you may have tried.


https://stackoverflow.com/questions/75142437/vs-2022-breakpoint-will-not-currently-be-hit-no-symbols-have-been-loaded-for-t  

Thursday, February 22, 2024

国外(加拿大)驾照换领国内(北京)驾照

 

需要提供:

1. 国外驾驶证原件及复印件

2. 身份证原件和复印件

3. 一寸白底彩色免冠照4张(注意考科目一的时候带上剩余照片)

4. 国外驾驶证翻译原件(不能自己翻译,可以用北京之外的翻译公司,我用的是淘宝找的成都博译翻译,不能用电子版)

5. 护照原件和复印件

6. 机动车驾驶人身体条件证明 (车管所旁边就有,一个体检机器,10分钟搞定)

这之后下载一个交管12123的手机App,预约考试,我约的是龙泉驾校。科目一题库应该就1600多道题,下载一个驾考宝典的App做一遍找出不会的,复习一下不会的就可以了。我准备比较仓促,模拟题做了好几遍只有考试当天早上以90分的成绩勉强通过一次,考试的时候也顺利一次通过(93)。考科目一当天要带着照片早点儿去,我约的是上午8:30到10:00,8点过一点儿主管就召集到教室开始讲考试注意事项了。手机有柜子存放,考试完毕签字后退柜子押金,就在驾校10分钟后就能领到驾照了,跟别的一样,6年有效期。



Sunday, January 21, 2024

local music files from MAC/PC to iPhone


需求: 准备回国,想把已经下载在计算机上的本地音乐文件包括APE,flac等无损格式到手机 iPhone

1. apple music: 可以添加play list,拖本地音乐文件加入,再同步。

两个问题,一是stuck on "Preparing To Sync",后来发现需要从activity monitor里面force quit MDCrashTool。另一个问题是一部分文件不能同步过去

2. QQ音乐

mac版qq音乐没有同步到设备的功能,windows版本有,但我的Parallel Desktop没有办法使用wireless connection,使用数据线连接QQ音乐能找到设备,但始终同步失败。上传到微盘很慢且一部分文件出错

3. 网易云音乐

都不能把本地文件加入到电脑端播放列表,直接删除

4. 酷我音乐

没有mac端桌面软件,但PC端桌面软件很好用,添加本地文件,传歌到设备都很完美。Parallel Desktop并未显示无线,但酷我能成功无线传歌到设备.

酷我的大问题是iphone广告太多了,点广告也只能有半个小时的播放时间。


Thursday, December 21, 2023

Peter Piper tongue twister

 Peter Piper picked a peck of pickled peppers.

A peck of pickled peppers Peter Piper picked.

If Peter Piper picked a peck of pickled peppers,

Where's the peck of pickled peppers Peter Piper picked?


Peter Piper picked a peck of pickled peppers.

If Peter Piper picked a peck of pickled peppers,

How many pickled peppers that Peter Piper picked?


Sunday, December 17, 2023

北京4050人员退休新政策

 北京4050人员退休新政策是什么

《北京市城镇登记失业人员灵活就业社会保险补贴办法》

第一条为了鼓励我市城镇登记失业人员灵活就业,根据《北京市人民政府贯彻落实国务院关于进一步加强就业再就业工作文件的通知》(京政发[2006]4号)精神,制定本办法。

第二条本办法适用于具有本市城镇户口,从事灵活就业,并办理了就业登记的城镇登记失业人员。

华律网

第三条城镇登记失业人员符合下列条件的,可以申请灵活就业社会保险补贴:

(一)女满40周岁,男满45周岁以上(以下简称“4045”失业人员)及中、重度残疾人;


(二)在社区从事家政服务与社区居民形成服务关系,或在区县、街道(乡镇)、社区统一安排下从事自行车修理、再生资源回收、便民理发、果蔬零售等社区服务性工作,以及没有固定工作单位,岗位不固定、工作时间不固定能够取得合法收入的其他灵活就业工作;

(三)已实现灵活就业满30日,并在户口所在区县劳动保障部门办理了个人就业登记。

第四条灵活就业社会保险补贴期限:

(一)符合第三条规定的“4045”失业人员及中度残疾人可以享受累计最长3年的社会保险补贴;

(二)距法定退休年龄不足5年的城镇登记失业人员及重度残疾人,可以享受累计最长5年的社会保险补贴。

第五条灵活就业社会保险补贴标准:

(一)基本养老保险以本市上年末职工月最低工资标准为缴费基数,按照28%的比例,补贴20%,个人缴纳8%;

(二)失业保险以本市上年末职工月最低工资标准为缴费基数,按照2%的比例,补贴1.5%,个人缴纳0.5%;

(三)基本医疗保险以本市上年职工月平均工资标准的70%为缴费基数,按照7%的比例,补贴6%,个人缴纳1%。

申请程序

1、申请人缴纳当年度养老、医疗保险三日后,凭本人

身份证、托管合同书和缴费票据原件,在市档案托管中心灵活就业人员社保补贴受理窗口初审,领取《申请表》和灵活就业证明。《申请表》只需填写一至七栏,贴照片。缴费票号、缴费金额和补贴金额部分不填。

2、灵活就业证明由申办人在其户口所在地社区劳动保障工作站登记盖章。

3、申请人持《申请表》、《灵活就业证明》及本人身份证、户口本等相关材料(一式三份)到街道(乡镇)劳动保障事务所申请复核,经审核无误后签字盖章(劳动保障事务所留存一份)。

4、申请人持《申请表》、《灵活就业证明》等相关材料到市档案托管中心受理窗口办理申报手续。

5、由市档案托管中心查阅档案,核对出生年月等情况无误后,汇总上报劳动保障部门。劳动保障部门审核后报财政部门拨付资金。

6、按照发放时间通知,申办人凭身份证和《受理卡》到指定银行领取社保补贴。

根据以上内容的相关的回答可以得出,在北京4050人员退休的政策必须是在满足年龄条件以及失业的情况,如果并没有稳定的工作,并且年龄也满足条件是有可能申请到4050的,如果您还有相关法律咨询可以致电华律网在线律师解答。



What is CORS

 What is CORS, what is preflight, how do you resolve it in Spring Boot?

WebMvcConfigurer CorsRegistry

后来 HTML5 支持了 CORS 协议。CORS 是一个 W3C 标准,全称是”跨域资源共享”(Cross-origin resource sharing),允许浏览器向跨源服务器,发出 XMLHttpRequest 请求,从而克服了 AJAX 只能同源使用的限制。它通过服务器增加一个特殊的 Header[Access-Control-Allow-Origin]来告诉客户端跨域的限制,如果浏览器支持 CORS、并且判断 Origin 通过的话,就会允许 XMLHttpRequest 发起跨域请求。

前端使用了 CORS 协议,就需要后端设置支持非同源的请求,Spring Boot 设置支持非同源的请求有两种方式。

第一,配置 CorsFilter。


@Configuration

public class GlobalCorsConfig {

    @Bean

    public CorsFilter corsFilter() {

        CorsConfiguration config = new CorsConfiguration();

          config.addAllowedOrigin("*");

          config.setAllowCredentials(true);

          config.addAllowedMethod("*");

          config.addAllowedHeader("*");

          config.addExposedHeader("*");


        UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource();

        configSource.registerCorsConfiguration("/**", config);


        return new CorsFilter(configSource);

    }

}



需要配置上述的一段代码。第二种方式稍微简单一些。

第二,在启动类上添加:


public class Application extends WebMvcConfigurerAdapter {  


    @Override  

    public void addCorsMappings(CorsRegistry registry) {  


        registry.addMapping("/**")  

                .allowCredentials(true)  

                .allowedHeaders("*")  

                .allowedOrigins("*")  

                .allowedMethods("*");  


    }  

}  





What is CSRF


How do you know a Spring Boot how many endpoints, and the endpoint details like path

How do you share session between different servers?


Microservice, UnknowHostException?



  1. Can you explain the differences between @RestController and @Controller annotations in Spring Boot?

  2. How do you implement security in a Spring Boot application?


How do you create and use Java annotations, and what are some common use cases for annotations?

Java annotations are metadata that provide additional information about the code to the compiler, runtime or other tools. They can be used to add information, enable/disable code generation or check code correctness.

Here are the steps to create and use Java annotations:

  1. What are the different operators available in RxJS, and how do you use them?

  2. What is the difference between the mergeMap and switchMap operators in RxJS?

  3. How do you use the retry operator in RxJS to retry an HTTP request?

  4. How do you use the combineLatest operator in RxJS to combine multiple observables?

  5. Can you explain the role of access tokens in OAuth 2.0?

  6. What is saml

In summary, while OAuth 2.0 is primarily designed for delegated authorization scenarios, SAML is designed for SSO scenarios.

Token type:

Access token/ID token/Refresh token/Reference token.


Access tokens can come in two flavours - self-contained or reference.

A JWT token would be a self-contained access token - it’s a protected data structure with claims and an expiration. Once an API has learned about the key material, it can validate self-contained tokens without needing to communicate with the issuer. This makes JWTs hard to revoke. They will stay valid until they expire.

When using reference tokens - IdentityServer will store the contents of the token in a data store and will only issue a unique identifier for this token back to the client. The API receiving this reference must then open a back-channel communication to IdentityServer to validate the token.

Reference tokens (sometimes also called opaque tokens) on the other hand are just identifiers for a token stored on the token service. The token service stores the contents of the token in some data store, associates it with an infeasible-to-guess id and passes the id back to the client. 

An ID token is encoded as a JSON Web Token (JWT).

An ID token is an artifact that proves that the user has been authenticated. It was introduced by OpenID Connect (OIDC).

In the OAuth 2 context, the access token allows a client application to access a specific resource to perform specific actions on behalf of the user. That is what is known as a delegated authorization scenario.

OAuth 2 core specifications say nothing about the access token format. It can be a string in any format. A common format used for access tokens is JWT.

An access token is a short-lived token that is used to access protected resources on behalf of an authenticated user.