Skip to content

Instantly share code, notes, and snippets.

@juananpe
Last active November 15, 2017 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juananpe/ce1cf0e8ea4faa683f28d0d39956827a to your computer and use it in GitHub Desktop.
Save juananpe/ce1cf0e8ea4faa683f28d0d39956827a to your computer and use it in GitHub Desktop.
CryptoBrokerDB (sql)
CREATE DATABASE `cryptobroker` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
CREATE TABLE `transactions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`message` json NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
@juananpe
Copy link
Author

SELECT JSON_UNQUOTE( JSON_EXTRACT(message, '$.price')) FROM transactions
where JSON_EXTRACT(message, '$.side') = "buy" and JSON_EXTRACT(message, '$.product_id') = "BTC-EUR" and JSON_EXTRACT(message, '$.type') = "open"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment