如何运行多个功能并创建列表?

时间:2018-05-04 14:15:19

标签: python ccxt

我是Python的新手,我有一个加密交换列表,我想与add_action('save_post', 'save_my_music_links'); function save_my_music_links($post_id) { if (!isset($_POST['link-music[]'])) { return; } if(defined('DOING_AUTOSAVE' && DOING_AUTOSAVE)){ return; } $my_links = sanitize_text_field($_POST['link-music[]']); update_post_meta($post_id, 'music-links', $my_links); } 库连接以获取OHLC数据。

但是为了逐个实例化每个交换类(许多对象),我想创建一个包含列表中所有交换数据的 Dim UserName As String ' Sets Username to current logged-in user profile UserName = Environment.UserName Dim JobNo As String JobNo = Textbox1.Text 'DOWNLOADING FROM THE FTP JOBS PROCESSED FOLDER Dim listRequest As FtpWebRequest = WebRequest.Create(“ftp.site.com/input/” & JobNo & "_*.DBF") listRequest.Credentials = New System.Net.NetworkCredential(“Username”, “Password”) listRequest.Method = WebRequestMethods.Ftp.ListDirectory Dim listResponse As FtpWebResponse = listRequest.GetResponse() Dim reader As StreamReader = New System.IO.StreamReader(listResponse.GetResponseStream()) Dim Filedata As String = reader.ReadToEnd Dim directory() As String = Filedata.Split(New String() {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) 'CREATES TEAM FILE FOLDERS ON LOCAL COMPUTER My.Computer.FileSystem.CreateDirectory("C:\users\" & UserName & "\desktop\TEAMFILES\IMB_APPEND\A_TEAM") My.Computer.FileSystem.CreateDirectory("C:\users\" & UserName & "\desktop\TEAMFILES\IMB_APPEND\B_TEAM") 'CLEAR TEXTBOX2 TextBox2.Clear() For Each foundFile As String In directory ATEAMdown(foundFile) TextBox2.Text = TextBox2.Text & foundFile & vbNewLine Next 'DOWNLOADING FROM THE IMB FTP XMPIE TEAM FOLDER listRequest = WebRequest.Create(“ftp.site.com/input/” & JobNo & "_*.DBF") listRequest.Credentials = New System.Net.NetworkCredential(“Username”, “Password”) listRequest.Method = WebRequestMethods.Ftp.ListDirectory listResponse = listRequest.GetResponse() reader = New System.IO.StreamReader(listResponse.GetResponseStream()) Filedata = reader.ReadToEnd directory = Filedata.Split(New String() {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries) For Each foundFile As String In directory BTEAMdown(foundFile) TextBox2.Text = TextBox2.Text & foundFile & vbNewLine Next 对象,以便我可以请求第一个交换的数据ccxt,来自第二位的数据exchanges

exchanges[0]

使用我会使用exchanges[1],但我怎样才能在Python中实现这一点?

2 个答案:

答案 0 :(得分:6)

只需使用getattr(...)和列表comp。

exchanges = [getattr(ccxt, e)() for e in ex] 

然后您可以按索引访问所有三个交易所。

答案 1 :(得分:0)

有什么问题
junk <- Map(`assign`, v1, v2, MoreArgs = list(envir = environment()))
a;b;c
## [1] 1
## [1] 2
## [1] 3