Cbpro issues, invalid price - algorithmic-trading

I'm using the following function from cbpro in order to buy some ETH. The dictionary returned is:
auth_client.buy(price='400', size = '0.00001', order_type = "market", product_id = currency)
{'message': 'Invalid price 400'}
Is the package broken or am I just being sutpid? Also tried in the form 400.00 but also not working.

Related

power query Expression.Error: We cannot convert a value of type Function to type List in power query

I am trying to run the query in power query editor and it failed with below error
where as the same query works fine in winserver 2016 and it fails with above error in win server 2019. Am I missing any thing ?
I did compared the settings and everything looks good.
let
//Get data Report H1
Source1 = Excel.Workbook(File.Contents("\\path\filename.xlsx"), null, true),
#"classic_Sheet1" = Source1{[Item = "classic", Kind = "Sheet"]}[Data],
#"Trimmed Text1" = Table.TransformColumns(#"classic_Sheet1", Text.Trim),
#"Third Row as Header1" = Table.PromoteHeaders(Table.Skip(#"Trimmed Text1", 2)),
#"Selected Columns1" = Table.SelectColumns(
#"Third Row as Header1",
{" ID", " Status", "Customer Id ", "Agent", "Leg"}
),
//Get Report H2
Source2 = Excel.Workbook(File.Contents("\\path\filename.xlsx"), null, true),
#"classic_Sheet2" = Source2{[Item = "classic", Kind = "Sheet"]}[Data],
#"Trimmed Text2" = Table.TransformColumns(#"classic_Sheet2", Text.Trim),
#"Third Row as Header2" = Table.PromoteHeaders(Table.Skip(#"Trimmed Text2", 2)),
#"Selected Columns2" = Table.SelectColumns(
#"Third Row as Header2",
{" ID", "Status", "Customer Id ", "Agent", "Leg"}
)
in
#"Excluded IDs"
The error message is pointing you to the problem:
Table.TransformColumns expects a list as the second parameter,
while you are providing a function:
Table.TransformColumns(
table as table,
transformOperations as list,
optional defaultTransformation as nullable function,
optional missingField as nullable number
) as table
Please read the official documentation here:
https://learn.microsoft.com/en-us/powerquery-m/table-transformcolumns
The issue has nothing to do with winserver 2016 or winserver 2019.
You want something along these lines
= Table.TransformColumns(#"classic_Sheet1",{{"ColumnNameHere", Text.Trim, type text}})
= Table.TransformColumns(#"classic_Sheet1"",{{"ColumnNameHere", Text.Trim, type text}, {"DifferentColumnNameHere", Text.Trim, type text}})

copying custom field value from sale order line to stock.move in odoo

Copying value from sale order line to stock move it shows only second row value in both rows. code:
[enter image description here][1]
from odoo import models, fields, api
class StockMove(models.Model):
#api.multi
def get_data(self):
data = self.env['sale.order.line'].search([])
print("Get Data Function")
for rec in data:
print(rec.x_serialnumber)
for record in self:
record.x_serialnumber = rec.x_serialnumber
_inherit = 'stock.move'
x_serialnumber = fields.Text(string="Serial Number", compute='get_data')"
On Sale order line it shows like this:
Serial Number: in both lines
112233
445566
But in stock move:
Serial Number: in both lines
445566
445566
Aurangzaib
Update your code:
#api.multi
def get_data(self):
for move in self:
if not (move.picking_id and move.picking_id.group_id):
continue
picking = move.picking_id
sale_order = self.env['sale.order'].sudo().search([
('procurement_group_id', '=', picking.group_id.id)], limit=1)
for line in sale_order.order_line:
if line.product_id.id != move.product_id.id:
continue
move.update({
'x_serialnumber': line.x_serialnumber,
})

CT_FETCH error in PowerBuilder Program

I'm still learning PowerBuilder and trying to get familiar with it. I'm receiving the following error when I try to run a program against a specific document in my database:
ct_fetch(): user api layer: internal common library error: The bind of result set item 4 resulted in an overflow. ErrCode: 2.
What does this error mean? What is item 4? This is only when I run this program against a specific document in my database, any other document works fine. Please see code below:
string s_doc_nmbr, s_doc_type, s_pvds_doc_status, s_sql
long l_rtn, l_current_fl, l_apld_fl, l_obj_id
integer l_pvds_obj_id, i_count
IF cbx_1.checked = True THEN
SELECT dsk_obj.obj_usr_num,
dsk_obj.obj_type,
preaward_validation_doc_status.doc_status,
preaward_validation_doc_status.obj_id
INTO :s_doc_nmbr, :s_doc_type, :s_pvds_doc_status, :l_pvds_obj_id
FROM dbo.dsk_obj dsk_obj,
preaward_validation_doc_status
WHERE dsk_obj.obj_id = :gx_l_doc_obj_id
AND preaward_validation_doc_status.obj_id = dsk_obj.obj_id
using SQLCA;
l_rtn = sqlca.uf_sqlerrcheck("w_pdutl095_main", "ue_run_script", TRUE)
IF l_rtn = -1 THEN
RETURN -1
END IF
//check to see if document (via obj_id) exists in the preaward_validation_doc_status table.
SELECT count(*)
into :i_count
FROM preaward_validation_doc_status
where obj_id = :l_pvds_obj_id
USING SQLCA;
IF i_count = 0 THEN
//document doesn't exist
// messagebox("Update Preaward Validation Doc Status", + gx_s_doc_nmbr + ' does not exist in the Preaward Validation Document Status table.', Stopsign!)
//MC - 070815-0030-MC Updating code to insert row into preaward_validation_doc_status if row doesn't already exist
// s_sql = "insert into preaward_validation_doc_status(obj_id, doc_status) values (:gx_l_doc_obj_id, 'SUCCESS') "
INSERT INTO preaward_validation_doc_status(obj_id, doc_status)
VALUES (:gx_l_doc_obj_id, 'SUCCESS')
USING SQLCA;
IF sqlca.sqldbcode <> 0 then
messagebox('SQL ERROR Message',string(sqlca.sqldbcode)+'-'+sqlca.sqlerrtext)
return -1
end if
MessageBox("PreAward Validation ", 'Document number ' + gx_s_doc_nmbr + ' has been inserted and marked as SUCCESS for PreAward Validation.')
return 1
Else
//Update document status in the preaward_validation_doc_status table to SUCCESS
Update preaward_validation_doc_status
Set doc_status = 'SUCCESS'
where obj_id = :l_pvds_obj_id
USING SQLCA;
IF sqlca.sqldbcode <> 0 then
messagebox('SQL ERROR Message',string(sqlca.sqldbcode)+'-'+sqlca.sqlerrtext)
return -1
end if
MessageBox("PreAward Validation ", 'Document number '+ gx_s_doc_nmbr + ' has been marked as SUCCESS for PreAward Validation.')
End IF
update crt_script
set alt_1 = 'Acknowledged' where
ticket_nmbr = :gx_s_ticket_nmbr and
alt_2 = 'Running' and
doc_nmbr = :gx_s_doc_nmbr
USING SQLCA;
Return 1
ElseIF cbx_1.checked = False THEN
messagebox("Update Preaward Validation Doc Status", 'The acknowledgment checkbox must be selected for the script to run successfully. The script will now exit. Please relaunch the script and try again . ', Stopsign!)
Return -1
End IF
Save yourself a ton of headaches and use datawindows... You'd reduce that entire script to about 10 lines of code.
Paul Horan gave you good advice. This would be simple using DataWindows or DataStores. Terry Voth is on the right track for your problem.
In your code, Variable l_pvds_obj_id needs to be the same type as gx_l_doc_obj_id because if you get a result, it will always be equal to it. From the apparent naming scheme it was intended to be long. This is the kind of stuff we look for in peer reviews.
A few other things:
Most of the time you want SQLCode not SQLDbCode but you didn't say what database you're using.
After you UPDATE crt_script you need to check the result.
I don't see COMMIT or ROLLBACK. Autocommit isn't suitable when you need to update multiple tables.
You aren't using most of the values from the first SELECT. Perhaps you've simplified your code for posting or troubleshooting.

FilePut returns unhandled exception of type 'System.ArgumentException'

I am writing in Visual Basic on Visual Studio 2013.
I have defined the Customer record structure in a module. I am trying to save to a fixed length record. However, when I try and save it comes back highlighting FilePut with the error message:
"An unhandled exception of type 'System.ArgumentException' occurred in
Microsoft.VisualBasic.dll".
My code for the subroutine is below:
'Open customer file to find what ID to use
FileOpen("1", "CustomerRecord.dat", OpenMode.Random, OpenAccess.ReadWrite)
'Find length of customer file
Dim RecordLength As Integer = Len(Customer)
'Populate customer ID with algorithm to find unique ID to use (Last ID used + 1)
txt_CustomerID.Text = Str(LOF(1) / RecordLength + 1)
'Find record number to write
Dim RecordToWrite As Integer = (LOF(1) / RecordLength + 1)
'Populate all the customer variables with the corresponding
'textbox information
Customer.CusID = Int(txt_CustomerID.Text)
Customer.Title = cmb_Title.Text
Customer.Forename = txt_Forename.Text
Customer.Surname = txt_Surname.Text
Customer.Postcode = txt_Postcode.Text
Customer.NameNo = txt_HouseName.Text
Customer.Town = txt_Town.Text
Customer.DOB = txt_DOB.Text
Customer.TelNo = txt_TelNo.Text
Customer.Email = txt_Email.Text
FilePut("1", Customer, RecordToWrite)
FileClose(1)
How would I solve this problem?

Gathering a user's news feed with Koala (Ruby)

I want to pull in a user's newsfeed after they have authenticated. I am using the Koala gem but if I call get_connection('me', 'feed') it only returns the last three posts on my wall. I want the last ~100 posts (or since post 1234567) that would show up on the user's home page.
You can get all posts during a certain time period using FQL. Here is an example that should get you started:
#feed = Koala::Facebook::API.new(current_user.token)
to = Time.now.to_i
yest = 1.day.ago.to_i
#feed.fql_query("SELECT post_id, actor_id, target_id, message, likes FROM stream WHERE source_id = me() AND created_time > #{yest} AND created_time < #{to} AND type = 80
AND strpos(attachment.href, "youtu") >= 0")
require 'koala'
#graph = Koala::Facebook::API.new("YOUR_ACCESS_TOKEN")
#graph.fql_query("SELECT post_id, actor_id, target_id, message FROM stream WHERE source_id = me() AND created_time > START_TIME AND created_time < END_TIME LIMIT 10")
Code borrowed from here.

Resources