with BitMEX and PostgreSQL?
Emit new event when a new column is added to a table. See the documentation
Emit new event when a row is added or modified. See the documentation
Emit new event when a new row is added to a table. See the documentation
Emit new event when new rows are returned from a custom query that you provide. See the documentation
Emit new event when a new table is added to the database. See the documentation
Deletes a row or rows from a table. See the documentation
Finds a row in a table via a lookup column. See the documentation
Finds a row in a table via a custom query. See the documentation
Adds a new row. See the documentation
import crypto from "crypto";
import { axios } from "@pipedream/platform";
export default defineComponent({
props: {
bitmex: {
type: "app",
app: "bitmex",
}
},
async run({ steps, $ }) {
// Set verb, path, and data as needed
const verb = "GET";
const path = "/api/v1/user";
const expires = Math.floor(Date.now() / 1000) + 60; // UNIX timestamp in seconds
const data = ""; // No body for GET
// Function to generate signature
function generateSignature(apiSecret, verb, path, expires, data) {
const message = verb + path + expires + data;
return crypto
.createHmac("sha256", apiSecret)
.update(message)
.digest("hex");
}
// Build headers
const signature = generateSignature(
this.bitmex.$auth.api_secret,
verb,
path,
expires,
data
);
const headers = {
"api-key": this.bitmex.$auth.api_key,
"api-expires": expires,
"api-signature": signature,
};
// Perform request
return await axios($, {
method: verb,
url: `${this.bitmex.$auth.api_url}${path}`,
headers,
});
},
})On Pipedream, you can leverage the PostgreSQL app to create workflows that automate database operations, synchronize data across platforms, and react to database events in real-time. Think handling new row entries, updating records from webhooks, or even compiling reports on a set schedule. Pipedream's serverless platform provides a powerful way to connect PostgreSQL with a variety of apps, enabling you to create tailored automation that fits your specific needs.
import postgresql from "@pipedream/postgresql"
export default defineComponent({
props: {
postgresql,
},
async run({ steps, $ }) {
// Component source code:
// https://github.com/PipedreamHQ/pipedream/tree/master/components/postgresql
const queryObj = {
text: "SELECT NOW()",
values: [], // Ignored since query does not contain placeholders
};
return await this.postgresql.executeQuery(queryObj);
},
})