Dear kindly guide, how we can create Amibroker database by taking data from Mongo DB or any other DB.
1 Like
Easiest way? Export from database to ASCII and import from ASCII to AmiBroker.
You can use ChatGPT to write code for you for export from Mongo, here is what ChatGPT wrote:
You can use the PyMongo library in Python to connect to your MongoDB database, and then use the csv module to write the data to a CSV file.
Here is some example code that you can use:
import csv
from pymongo import MongoClient
# connect to MongoDB
client = MongoClient('localhost', 27017)
db = client['mydatabase']
# specify the collection to export
collection = db['mycollection']
# specify the fields to export
fields = ['field1', 'field2', 'field3']
# open a new file in write mode
with open('exported_data.csv', 'w', newline='') as file:
# create a CSV writer object
writer = csv.writer(file)
# write the header row
writer.writerow(fields)
# query the collection and write each document to the CSV file
for document in collection.find():
row = [document[field] for field in fields]
writer.writerow(row)
Later import data using AmiBroker Import Wizard
https://www.amibroker.com/guide/w_impwizard.html
(no coding necessary)
5 Likes