How to liquidate isolated margin loan on binance spot? - binance

I'm unable to find a reliable way to repay my margin loan. I tried calling the margin-repay endpoint but there are cases where I'm getting an error:
APIError(code=-3041): Balance is not enough
Whenever that happens I'm forced to enter the WebUI and manually click on the button called "Close All Positions" which immediately liquidates all open positions in order to repay my margin loan.
Is there an equivalent API endpoint which immediately kills open positions and repays the margin loan?

Related

event listener when tab is changed

I need to store some data every time I move to some other tab in the same window or some other window using chrome storage API or even when a new tab is created. So, basically when my active tab is no longer active anymore.
So, for example, If I am on tab A and then I move to tab B(or create a new tab). When this switching happens from A to B, I need to save data from the website running in tab A. (I am getting the data from the site in tab A using content script.)
A more concrete example would be, suppose I am on YOutube site and I have a timeout timer running(using a content script). So when I move to some other site I want to stop the time get the current remaining time and save that. and if the other site is youtube too(in tab B) I would start the time from the previously saved value.
Is there any event listener for this? I looked at the documentation for chrome.tabs but could not figure it out.
I saw onActivated event listener but I am not sure if that would be useful.
Or is there some other way to achieve this?
Yes, according to the documentation onActivated:
Fires when the active tab in a window changes.
As an alternative, also can use content scripts that notify your extension when a page gain or loses focus with window.onfocus and window.onblur.
This way you'll be able to track the visibility of the tabs, though you should carefully select the required permission.

Blue prism - Scrolling a web page

Is there any way that we can scroll down in a webpage till an element where we want any verification or want to enter values ?
Another question is that I used global send keys to scroll a page. It works in object studio if I provide an interval of 0 (as inputs set tends to Yes), but from process studio I get an error as follows
"Internal : Failed To perform Step 1 In Navigate Stage 'Trying scroll' on page 'Select hotel' - Special characters (~{}+^%) are not supported in SendKeys if an interval value is provided. Separate calls can be used to send control characters."
how to overcome such situation ?
Try removing the interval = 0. If this doesn't work, can you please share a screenshot of your action inside the object and the Navigation stage that you are using to send keys?

Providing delay between two codes in j2me

I am trying j2me code in which i am putting to thingd a alert message and setCurrentItem()
function..
display.setCurrent(alert);
display.setCurrentItem(textBox)
the problem is that before we can see the alert msg it disappear and because of display.setCurrent(textBox). what should i do to see the alert message correctly and than move to the item which is placed im display.setCurrentItem??
I don't really do any High Level GUI coding (meaning Form stuff), so I'm no expert.
But looking at the docs, I can see a setTimeout(int time) function on the Alert object.
So my guess is that you should display the TextBox first, and then display the Alert afterwards with a timeout.
alert.setTimeout(5000); // 5 seconds
display.setCurrent(textBox);
display.setCurrent(alert);
That should display the alert for 5 seconds, and then when dismissed, the textBox should appear.
Looking at the Display object, I also notice another function called setCurrent(Alert alert, Displayable nextDisplayable) though, which seems to be even better.
Using that method you should be able to just do
Display.setCurrent(alert, textBox);
The docs says the following about that method: "Requests that this Alert be made current, and that nextDisplayable be made current after the Alert is dismissed. This call returns immediately regardless of the Alert's timeout value or whether it is a modal alert. The nextDisplayable must not be an Alert, and it must not be null."
Bookmark and use this page a lot:
http://docs.oracle.com/javame/config/cldc/ref-impl/midp2.0/jsr118/

Show alert with Indeterminate progress indicator Nokia Full Touch j2me

Does anyone know how to show a spinner for progress bar in a j2me alert?
Here is my piece of code so far:
loadingDialog = new Alert("Please Wait","Please Wait.",null,AlertType.INFO);
Gauge gau = new Gauge( null, false,
Gauge.INDEFINITE,
Gauge.CONTINUOUS_RUNNING );
loadingDialog.setIndicator(gau);
loadingDialog.setTimeout(500000);
displays.setCurrent(loadingDialog);
I am getting a horizontal line (like a slider). What I want is a spinner in place of it.
http://www.developer.nokia.com/Resources/Library/Full_Touch/ui-components/progress-indication.html
The second image (labelled non interactive gauge) of the link is what I am looking for:
The way how you create Gauge looks about right, in accordance with instructions given at Nokia page you refer as well as with Gauge API javadocs (available online):
CONTINUOUS_RUNNING
The value representing the continuous-running state of a non-interactive Gauge with indefinite range.
...
INDEFINITE
A special value used for the maximum value in order to indicate that the Gauge has indefinite range.
Explanation at Nokia page (somewhat vague) suggests the most likely reason for the issue you describe is that Nokia shows spinner only in forms, not in alerts:
- Indefinite gauge in Java Form uses spinner.
- An Alert uses a "barber shop roll" (animated bar of fixed length).
The way to test above assumption is to put Gauge like yours into the Form instead of Alert and see how device / emulator displays it.
If Form shows spinner, then the most straightforward workaround is to use Form instead of Alert. In this case, since Form lack "dismissal" feature provided by Alert, you would have to implement it yourself - eg by using TimerTask to schedule form replacement with previous screen.
Hehehe, the clue is in the link you gave --
Java Alerts do not use spinners due to layout constraints.
So it's not possible!

Requesting Advice with parallel programming and webrequest

Currently I have about 20 websites in a list box on my windows form that contain url's.
Each url will navigate to the website download a picture and place the picture into a picture box on the windows form
I have setup 4 picture boxes for the pictures to be entered into.
The user will see the picture of an animal and then will type in the picture and hit a submit button to send the result back to the website for confirmation.
My problem is that when I do try to implement a thread pool I don't have enough time to enter the name of the animal before the next picture loads.
Would it be better for me to create each thread manually and then toggle the button that submits the picture to the site to destroy the thread and grab the next one? I'm very confused. Any help would be awesome.
Thanks
you can use workers to do your background stuff, and a setinterval hack to simulate threads.
start throwing events, and move up the thread ladder when the event signifying completion is thrown.

Resources